X-Git-Url: https://git.immae.eu/?a=blobdiff_plain;f=systems%2Fzoldene%2Fdisko.nix;h=7df56976d53be2ac6fad620b0ef2d9d58897df31;hb=1a64deeb894dc95e2645a75771732c6cc53a79ad;hpb=fa25ffd4583cc362075cd5e1b4130f33306103f0;p=perso%2FImmae%2FConfig%2FNix.git 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 @@ +{ cryptKeyFile, ... }: { + disko.devices = let + zpoolDatasets = { + "root" = { type = "zfs_fs"; options.mountpoint = "none"; }; + "root/persist" = { type = "zfs_fs"; mountpoint = "/persist/zpool"; options.mountpoint = "legacy"; }; + }; + zfastDatasets = { + "root" = { type = "zfs_fs"; mountpoint = "/"; options.mountpoint = "legacy"; postCreateHook = "zfs snapshot zfast/root@blank"; }; + "root/nix" = { type = "zfs_fs"; mountpoint = "/nix"; options.mountpoint = "legacy"; }; + "root/persist" = { type = "zfs_fs"; mountpoint = "/persist/zfast"; options.mountpoint = "legacy"; }; + "root/persist/var" = { type = "zfs_fs"; mountpoint = "/persist/zfast/var"; options.mountpoint = "legacy"; }; + "root/persist/var/lib" = { type = "zfs_fs"; mountpoint = "/persist/zfast/var/lib"; options.mountpoint = "legacy"; }; + }; + in { + disk = { + sda = { + type = "disk"; + device = "/dev/disk/by-id/ata-SAMSUNG_MZ7LM480HCHP-00003_S1YJNYAG700613"; + content = { + type = "table"; + format = "gpt"; + partitions = [ + { start = "2GiB"; end = "-8GiB"; name = "ssdLuksA"; content = { type = "luks"; name = "ssdA"; keyFile = cryptKeyFile; content = { type = "zfs"; pool = "zfast"; }; }; } + { start = "-8GiB"; end = "-2MiB"; name = "swapA"; flags = [ "swap" ]; content = { type = "swap"; }; } + { start = "2048s"; end = "4095s"; name = "ssdGrubA"; flags = [ "bios_grub" ]; } + { start = "4096s"; end = "2GiB"; name = "ssdBootA"; content = { type = "filesystem"; format = "ext4"; mountpoint = "/boot"; }; } + ]; + }; + }; + sdb = { + type = "disk"; + device = "/dev/disk/by-id/ata-SAMSUNG_MZ7LM480HCHP-00003_S1YJNYAG700682"; + content = { + type = "table"; + format = "gpt"; + partitions = [ + { start = "2GiB"; end = "-8GiB"; name = "ssdLuksB"; content = { type = "luks"; name = "ssdB"; keyFile = cryptKeyFile; content = { type = "zfs"; pool = "zfast"; }; }; } + { start = "-8GiB"; end = "-2MiB"; name = "swapB"; flags = [ "swap" ]; content = { type = "swap"; }; } + { start = "2048s"; end = "4095s"; name = "ssdGrubB"; flags = [ "bios_grub" ]; } + #{ start = "4096s"; end = "2GiB"; name = "ssdBootB"; content = { type = "filesystem"; format = "ext4"; }; } # non monté + ]; + }; + }; + sdc = { + type = "disk"; + device = "/dev/disk/by-id/ata-ST4000NM0245-1Z2107_ZC110SY1"; + content = { + type = "table"; + format = "gpt"; + partitions = [ + { start = "2048s"; end = "-34s"; name = "hddLuksA"; content = { type = "luks"; name = "bigA"; keyFile = cryptKeyFile; content = { type = "zfs"; pool = "zpool"; }; }; } + ]; + }; + }; + sdd = { + type = "disk"; + device = "/dev/disk/by-id/ata-ST4000NM0245-1Z2107_ZC110YXX"; + content = { + type = "table"; + format = "gpt"; + partitions = [ + { start = "2048s"; end = "-34s"; name = "hddLuksB"; content = { type = "luks"; name = "bigB"; keyFile = cryptKeyFile; content = { type = "zfs"; pool = "zpool"; }; }; } + ]; + }; + }; + }; + + zpool = { + zpool = { + type = "zpool"; + mode = "mirror"; + mountRoot = "/"; + rootFsOptions = { mountpoint = "none"; atime = "off"; xattr = "sa"; acltype = "posix"; }; + options = { ashift = "12"; }; + datasets = zpoolDatasets; + }; + zfast = { + type = "zpool"; + mode = "mirror"; + mountRoot = "/"; + rootFsOptions = { mountpoint = "none"; atime = "off"; xattr = "sa"; acltype = "posix"; }; + options = { ashift = "12"; }; + datasets = zfastDatasets; + }; + }; + }; +}