diff options
Diffstat (limited to 'systems/zoldene/disko.nix')
-rw-r--r-- | systems/zoldene/disko.nix | 87 |
1 files changed, 87 insertions, 0 deletions
diff --git a/systems/zoldene/disko.nix b/systems/zoldene/disko.nix new file mode 100644 index 0000000..7df5697 --- /dev/null +++ b/systems/zoldene/disko.nix | |||
@@ -0,0 +1,87 @@ | |||
1 | { cryptKeyFile, ... }: { | ||
2 | disko.devices = let | ||
3 | zpoolDatasets = { | ||
4 | "root" = { type = "zfs_fs"; options.mountpoint = "none"; }; | ||
5 | "root/persist" = { type = "zfs_fs"; mountpoint = "/persist/zpool"; options.mountpoint = "legacy"; }; | ||
6 | }; | ||
7 | zfastDatasets = { | ||
8 | "root" = { type = "zfs_fs"; mountpoint = "/"; options.mountpoint = "legacy"; postCreateHook = "zfs snapshot zfast/root@blank"; }; | ||
9 | "root/nix" = { type = "zfs_fs"; mountpoint = "/nix"; options.mountpoint = "legacy"; }; | ||
10 | "root/persist" = { type = "zfs_fs"; mountpoint = "/persist/zfast"; options.mountpoint = "legacy"; }; | ||
11 | "root/persist/var" = { type = "zfs_fs"; mountpoint = "/persist/zfast/var"; options.mountpoint = "legacy"; }; | ||
12 | "root/persist/var/lib" = { type = "zfs_fs"; mountpoint = "/persist/zfast/var/lib"; options.mountpoint = "legacy"; }; | ||
13 | }; | ||
14 | in { | ||
15 | disk = { | ||
16 | sda = { | ||
17 | type = "disk"; | ||
18 | device = "/dev/disk/by-id/ata-SAMSUNG_MZ7LM480HCHP-00003_S1YJNYAG700613"; | ||
19 | content = { | ||
20 | type = "table"; | ||
21 | format = "gpt"; | ||
22 | partitions = [ | ||
23 | { start = "2GiB"; end = "-8GiB"; name = "ssdLuksA"; content = { type = "luks"; name = "ssdA"; keyFile = cryptKeyFile; content = { type = "zfs"; pool = "zfast"; }; }; } | ||
24 | { start = "-8GiB"; end = "-2MiB"; name = "swapA"; flags = [ "swap" ]; content = { type = "swap"; }; } | ||
25 | { start = "2048s"; end = "4095s"; name = "ssdGrubA"; flags = [ "bios_grub" ]; } | ||
26 | { start = "4096s"; end = "2GiB"; name = "ssdBootA"; content = { type = "filesystem"; format = "ext4"; mountpoint = "/boot"; }; } | ||
27 | ]; | ||
28 | }; | ||
29 | }; | ||
30 | sdb = { | ||
31 | type = "disk"; | ||
32 | device = "/dev/disk/by-id/ata-SAMSUNG_MZ7LM480HCHP-00003_S1YJNYAG700682"; | ||
33 | content = { | ||
34 | type = "table"; | ||
35 | format = "gpt"; | ||
36 | partitions = [ | ||
37 | { start = "2GiB"; end = "-8GiB"; name = "ssdLuksB"; content = { type = "luks"; name = "ssdB"; keyFile = cryptKeyFile; content = { type = "zfs"; pool = "zfast"; }; }; } | ||
38 | { start = "-8GiB"; end = "-2MiB"; name = "swapB"; flags = [ "swap" ]; content = { type = "swap"; }; } | ||
39 | { start = "2048s"; end = "4095s"; name = "ssdGrubB"; flags = [ "bios_grub" ]; } | ||
40 | #{ start = "4096s"; end = "2GiB"; name = "ssdBootB"; content = { type = "filesystem"; format = "ext4"; }; } # non monté | ||
41 | ]; | ||
42 | }; | ||
43 | }; | ||
44 | sdc = { | ||
45 | type = "disk"; | ||
46 | device = "/dev/disk/by-id/ata-ST4000NM0245-1Z2107_ZC110SY1"; | ||
47 | content = { | ||
48 | type = "table"; | ||
49 | format = "gpt"; | ||
50 | partitions = [ | ||
51 | { start = "2048s"; end = "-34s"; name = "hddLuksA"; content = { type = "luks"; name = "bigA"; keyFile = cryptKeyFile; content = { type = "zfs"; pool = "zpool"; }; }; } | ||
52 | ]; | ||
53 | }; | ||
54 | }; | ||
55 | sdd = { | ||
56 | type = "disk"; | ||
57 | device = "/dev/disk/by-id/ata-ST4000NM0245-1Z2107_ZC110YXX"; | ||
58 | content = { | ||
59 | type = "table"; | ||
60 | format = "gpt"; | ||
61 | partitions = [ | ||
62 | { start = "2048s"; end = "-34s"; name = "hddLuksB"; content = { type = "luks"; name = "bigB"; keyFile = cryptKeyFile; content = { type = "zfs"; pool = "zpool"; }; }; } | ||
63 | ]; | ||
64 | }; | ||
65 | }; | ||
66 | }; | ||
67 | |||
68 | zpool = { | ||
69 | zpool = { | ||
70 | type = "zpool"; | ||
71 | mode = "mirror"; | ||
72 | mountRoot = "/"; | ||
73 | rootFsOptions = { mountpoint = "none"; atime = "off"; xattr = "sa"; acltype = "posix"; }; | ||
74 | options = { ashift = "12"; }; | ||
75 | datasets = zpoolDatasets; | ||
76 | }; | ||
77 | zfast = { | ||
78 | type = "zpool"; | ||
79 | mode = "mirror"; | ||
80 | mountRoot = "/"; | ||
81 | rootFsOptions = { mountpoint = "none"; atime = "off"; xattr = "sa"; acltype = "posix"; }; | ||
82 | options = { ashift = "12"; }; | ||
83 | datasets = zfastDatasets; | ||
84 | }; | ||
85 | }; | ||
86 | }; | ||
87 | } | ||