{ lib, root-disk ? "Expected a mf disk brother", raid-disks ? "Expected disks for raid", ... }: { disko.devices = { disk = { main = { type = "disk"; device = root-disk; content = { type = "gpt"; partitions = { boot = { size = "512M"; type = "EF00"; content = { type = "filesystem"; format = "vfat"; mountpoint = "/boot"; mountOptions = ["umask=0077"]; }; }; root = { size = "100%"; content = { type = "filesystem"; format = "ext4"; mountpoint = "/"; }; }; }; }; }; # disk2 = { # type = "disk"; # device = "/dev/my-disk2"; # content = { # type = "gpt"; # partitions = { # boot = { # size = "1M"; # type = "EF02"; # for grub MBR # }; # mdadm = { # size = "100%"; # content = { # type = "mdraid"; # name = "raid1"; # }; # }; # }; # }; # }; } // lib.attrsets.genAttrs raid-disks (name: { type = "disk"; device = "/dev/" + name; content = { type = "gpt"; partitions = { zfs = { size = "100%"; content = { type = "zfs"; pool = "storage"; }; }; }; }; }); zpool = lib.mkIf (builtins.length raid-disks > 0) { storage = { type = "zpool"; mode = "raidz"; # TODO: Cache-ing # rootFsOptions = { # compression = "zstd"; # "com.sun:auto-snapshot" = "false"; # }; mountpoint = "/storage"; datasets = { var = { type = "zfs_fs"; mountpoint = "/storage/var"; }; }; }; }; }; }