{ lib , root-disk ? "Expected a mf disk brother" , raid-disks ? "Expected disks for raid" , ... }: { disko.devices = { disk = { root = { type = "disk"; device = root-disk; content = { type = "gpt"; partitions = { ESP = { size = "512M"; type = "EF00"; content = { type = "filesystem"; format = "vfat"; mountpoint = "/boot"; mountOptions = [ "umask=0077" ]; }; }; zfs = { size = "100%"; content = { type = "zfs"; pool = "zroot"; }; }; }; }; }; } // lib.attrsets.genAttrs raid-disks ( name: { device = "/dev/" + name; content = { type = "gpt"; partitions.raid-pool = { size = "100%"; content = { type = "zfs"; pool = "zraid"; }; }; }; } ); zpool = { zroot = { type = "zpool"; rootFsOptions = { mountpoint = "none"; compression = "zstd"; acltype = "posixacl"; xattr = "sa"; "com.sun:auto-snapshot" = "false"; }; options = { ashift = "12"; }; datasets = { "root" = { type = "zfs_fs"; options = { # encryption = "aes-256-gcm"; # keyformat = "passphrase"; # keylocation = "prompt"; }; mountpoint = "/"; }; "root/nix" = { type = "zfs_fs"; options.mountpoint = "/nix"; mountpoint = "/nix"; }; }; }; zraid = lib.mkIf (builtins.length raid-disks > 0) { type = "zpool"; mode = "raidz"; options = { ashift = "12"; autotrim = "on"; autoexpand = "on"; }; rootFsOptions = { compression = "zstd"; mountpoint = "none"; }; datasets = { "var" = { type = "zfs_fs"; mountpoint = "/var"; }; "home" = { type = "zfs_fs"; mountpoint = "/home"; }; }; }; }; }; }