{ standardWithHibernateSwap = { disks ? ["/dev/sda"], swapSize, ... }: { # this is my standard partitioning scheme for my machines which probably want hibernation capabilities # a UEFI-compatible boot partition # it includes an LUKS-encrypted btrfs volume # a swap partition big enough to dump all the machine's RAM into disko.devices = { disk = { primary = { type = "disk"; device = builtins.elemAt disks 0; content = { type = "gpt"; partitions = { ESP = { label = "EFI"; name = "ESP"; size = "4G"; type = "EF00"; content = { type = "filesystem"; format = "vfat"; mountpoint = "/boot"; mountOptions = [ "defaults" ]; }; }; swap = { size = swapSize; content = { type = "swap"; discardPolicy = "both"; resumeDevice = true; # resume from hiberation from this device }; }; luks = { size = "100%"; content = { type = "luks"; name = "crypted"; extraOpenArgs = ["--allow-discards"]; # if you want to use the key for interactive login be sure there is no trailing newline # for example use `echo -n "password" > /tmp/secret.key` keyFile = "/tmp/secret.key"; # Interactive # settings.keyFile = "/tmp/password.key"; # additionalKeyFiles = ["/tmp/additionalSecret.key"]; content = { type = "btrfs"; extraArgs = ["-f"]; subvolumes = { "/nixos" = { mountpoint = "/"; mountOptions = ["compress=zstd" "noatime"]; }; "/home" = { mountpoint = "/home"; mountOptions = ["compress=zstd" "noatime"]; }; "/nix" = { mountpoint = "/nix"; mountOptions = ["compress=zstd" "noatime"]; }; }; }; }; }; }; }; }; }; }; }; standard = {disks ? ["/dev/vda"], ...}: { # this is my standard partitioning scheme for my machines: an LUKS-encrypted # btrfs volume disko.devices = { disk = { primary = { type = "disk"; device = builtins.elemAt disks 0; content = { type = "gpt"; partitions = { ESP = { label = "EFI"; name = "ESP"; size = "512M"; type = "EF00"; content = { type = "filesystem"; format = "vfat"; mountpoint = "/boot"; mountOptions = [ "defaults" ]; }; }; luks = { size = "100%"; content = { type = "luks"; name = "crypted"; extraOpenArgs = ["--allow-discards"]; # if you want to use the key for interactive login be sure there is no trailing newline # for example use `echo -n "password" > /tmp/secret.key` keyFile = "/tmp/secret.key"; # Interactive # settings.keyFile = "/tmp/password.key"; # additionalKeyFiles = ["/tmp/additionalSecret.key"]; content = { type = "btrfs"; extraArgs = ["-f"]; subvolumes = { "/root" = { mountpoint = "/"; mountOptions = ["compress=zstd" "noatime"]; }; "/home" = { mountpoint = "/home"; mountOptions = ["compress=zstd" "noatime"]; }; "/nix" = { mountpoint = "/nix"; mountOptions = ["compress=zstd" "noatime"]; }; }; }; }; }; }; }; }; }; }; }; # TODO: figure out what I can't have an optiona/default 'name' attribute here so I can DRY with "standard" thinker = {disks ? ["/dev/vda"], ...}: { disko.devices = { disk = { vdb = { type = "disk"; device = builtins.elemAt disks 0; content = { type = "gpt"; partitions = { ESP = { label = "EFI"; name = "ESP"; size = "512M"; type = "EF00"; content = { type = "filesystem"; format = "vfat"; mountpoint = "/boot"; mountOptions = [ "defaults" ]; }; }; luks = { size = "100%"; content = { type = "luks"; name = "crypted"; extraOpenArgs = ["--allow-discards"]; # if you want to use the key for interactive login be sure there is no trailing newline # for example use `echo -n "password" > /tmp/secret.key` keyFile = "/tmp/secret.key"; # Interactive # settings.keyFile = "/tmp/password.key"; # additionalKeyFiles = ["/tmp/additionalSecret.key"]; content = { type = "btrfs"; extraArgs = ["-f"]; subvolumes = { "/root" = { mountpoint = "/"; mountOptions = ["compress=zstd" "noatime"]; }; "/home" = { mountpoint = "/home"; mountOptions = ["compress=zstd" "noatime"]; }; "/nix" = { mountpoint = "/nix"; mountOptions = ["compress=zstd" "noatime"]; }; }; }; }; }; }; }; }; }; }; }; unencrypted = {disks ? ["/dev/vda"], ...}: { disko.devices = { disk = { primary = { type = "disk"; device = builtins.elemAt disks 0; content = { type = "gpt"; partitions = { ESP = { label = "EFI"; name = "ESP"; size = "512M"; type = "EF00"; content = { type = "filesystem"; format = "vfat"; mountpoint = "/boot"; mountOptions = [ "defaults" ]; }; }; root = { size = "100%"; content = { type = "btrfs"; extraArgs = ["-f"]; subvolumes = { "/root" = { mountpoint = "/"; mountOptions = []; }; "/home" = { mountpoint = "/home"; mountOptions = ["compress=zstd"]; }; "/nix" = { mountpoint = "/nix"; mountOptions = ["compress=zstd" "noatime"]; }; }; }; }; }; }; }; }; }; }; legacy = {disks ? ["/dev/vda"], ...}: { disko.devices = { disk = { primary = { device = builtins.elemAt disks 0; type = "disk"; content = { type = "table"; format = "gpt"; partitions = [ { label = "EFI"; name = "ESP"; size = "512M"; bootable = true; content = { type = "filesystem"; format = "vfat"; mountpoint = "/boot"; }; } { name = "root"; start = "500M"; end = "100%"; part-type = "primary"; bootable = true; content = { type = "filesystem"; format = "ext4"; mountpoint = "/"; }; } ]; }; }; }; }; }; }