Skip to content

Commit d0cc5c3

Browse files
committed
feat(X13Gen2): integrate disko for disk partitioning and management
- Added disko as a new input in flake.nix and flake.lock - Configured disko module in X13Gen2 nixosSystem definition - Introduced a new disko-config.nix file for partitioning and filesystem setup - Updated default.nix to include disko-config.nix in the modules list - Removed legacy filesystem definitions from hardware-configuration.nix
1 parent 132f2b4 commit d0cc5c3

File tree

5 files changed

+98
-22
lines changed

5 files changed

+98
-22
lines changed

flake.lock

Lines changed: 27 additions & 6 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

flake.nix

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,10 @@
4242
url = "github:natsukium/mcp-servers-nix";
4343
inputs.nixpkgs.follows = "nixpkgs";
4444
};
45+
disko = {
46+
url = "github:nix-community/disko";
47+
inputs.nixpkgs.follows = "nixpkgs";
48+
};
4549
};
4650

4751
outputs =
@@ -65,7 +69,13 @@
6569
OPL2212-2 = import ./hosts/OPL2212-2 { inherit inputs; };
6670
};
6771
nixosConfigurations = {
68-
X13Gen2 = import ./hosts/X13Gen2 { inherit inputs; };
72+
X13Gen2 = inputs.nixpkgs.lib.nixosSystem {
73+
system = "x86_64-linux";
74+
modules = [
75+
./hosts/X13Gen2
76+
inputs.disko.nixosModules.disko
77+
];
78+
};
6979
};
7080
nixOnDroidConfigurations = {
7181
OPPO-A79 = import ./hosts/OPPO-A79 { inherit inputs; };

hosts/X13Gen2/default.nix

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ nixpkgs.lib.nixosSystem {
1515
modules = [
1616
../../nixos
1717
./hardware-configuration.nix
18+
./disko-config.nix
1819
sops-nix.nixosModules.sops
1920
home-manager.nixosModules.home-manager
2021
{

hosts/X13Gen2/disko-config.nix

Lines changed: 59 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,59 @@
1+
{ lib, ... }:
2+
{
3+
disko.devices = {
4+
disk = {
5+
main = {
6+
type = "disk";
7+
device = "/dev/nvme0n1"; # Change this to your disk device
8+
content = {
9+
type = "gpt";
10+
partitions = {
11+
ESP = {
12+
size = "512M";
13+
type = "EF00";
14+
content = {
15+
type = "filesystem";
16+
format = "vfat";
17+
mountpoint = "/boot";
18+
};
19+
};
20+
root = {
21+
size = "100%";
22+
content = {
23+
type = "btrfs";
24+
extraArgs = [ "-f" ]; # Override existing partitions
25+
subvolumes = {
26+
"/root" = {
27+
mountpoint = "/";
28+
mountOptions = [
29+
"compress=zstd"
30+
"noatime"
31+
];
32+
};
33+
"/home" = {
34+
mountpoint = "/home";
35+
mountOptions = [
36+
"compress=zstd"
37+
"noatime"
38+
];
39+
};
40+
"/nix" = {
41+
mountpoint = "/nix";
42+
mountOptions = [
43+
"compress=zstd"
44+
"noatime"
45+
];
46+
};
47+
"/swap" = {
48+
mountpoint = "/swap";
49+
swap.swapfile.size = "8G";
50+
};
51+
};
52+
};
53+
};
54+
};
55+
};
56+
};
57+
};
58+
};
59+
}

hosts/X13Gen2/hardware-configuration.nix

Lines changed: 0 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -24,21 +24,6 @@
2424
extraModulePackages = [ ];
2525
};
2626

27-
fileSystems = {
28-
"/" = {
29-
device = "/dev/disk/by-uuid/643f028c-88a5-45af-b7b8-52d78f05a501";
30-
fsType = "ext4";
31-
};
32-
"/boot" = {
33-
device = "/dev/disk/by-uuid/A44D-7A24";
34-
fsType = "vfat";
35-
options = [
36-
"fmask=0022"
37-
"dmask=0022"
38-
];
39-
};
40-
};
41-
4227
nixpkgs.hostPlatform = lib.mkDefault "x86_64-linux";
4328
networking.useDHCP = lib.mkDefault true;
4429
hardware.cpu.amd.updateMicrocode = lib.mkDefault config.hardware.enableRedistributableFirmware;

0 commit comments

Comments
 (0)