2023-09-05 15:49:05 -05:00
|
|
|
{
|
2023-10-03 11:52:44 -05:00
|
|
|
standard = {disks ? ["/dev/vda"], ...}: {
|
2023-09-05 15:33:20 -05:00
|
|
|
# this is my standard partitioning scheme for my machines: an LUKS-encrypted
|
|
|
|
# btrfs volume
|
|
|
|
disko.devices = {
|
|
|
|
disk = {
|
2023-10-02 14:40:35 -05:00
|
|
|
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";
|
2023-10-03 11:52:44 -05:00
|
|
|
extraOpenArgs = ["--allow-discards"];
|
2023-10-02 14:40:35 -05:00
|
|
|
# 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";
|
2023-10-03 11:52:44 -05:00
|
|
|
extraArgs = ["-f"];
|
2023-10-02 14:40:35 -05:00
|
|
|
subvolumes = {
|
|
|
|
"/root" = {
|
|
|
|
mountpoint = "/";
|
2023-10-03 11:52:44 -05:00
|
|
|
mountOptions = ["compress=zstd" "noatime"];
|
2023-10-02 14:40:35 -05:00
|
|
|
};
|
|
|
|
"/home" = {
|
|
|
|
mountpoint = "/home";
|
2023-10-03 11:52:44 -05:00
|
|
|
mountOptions = ["compress=zstd" "noatime"];
|
2023-10-02 14:40:35 -05:00
|
|
|
};
|
|
|
|
"/nix" = {
|
|
|
|
mountpoint = "/nix";
|
2023-10-03 11:52:44 -05:00
|
|
|
mountOptions = ["compress=zstd" "noatime"];
|
2023-10-02 14:40:35 -05:00
|
|
|
};
|
|
|
|
};
|
|
|
|
};
|
|
|
|
};
|
|
|
|
};
|
|
|
|
};
|
|
|
|
};
|
|
|
|
};
|
|
|
|
};
|
|
|
|
};
|
|
|
|
};
|
|
|
|
# TODO: figure out what I can't have an optiona/default 'name' attribute here so I can DRY with "standard"
|
2023-10-03 11:52:44 -05:00
|
|
|
thinker = {disks ? ["/dev/vda"], ...}: {
|
2023-10-02 14:40:35 -05:00
|
|
|
disko.devices = {
|
|
|
|
disk = {
|
2023-10-04 13:49:48 -05:00
|
|
|
vdb = {
|
2023-09-05 15:33:20 -05:00
|
|
|
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";
|
2023-10-03 11:52:44 -05:00
|
|
|
extraOpenArgs = ["--allow-discards"];
|
2023-09-05 15:33:20 -05:00
|
|
|
# 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";
|
2023-10-03 11:52:44 -05:00
|
|
|
extraArgs = ["-f"];
|
2023-09-05 15:33:20 -05:00
|
|
|
subvolumes = {
|
|
|
|
"/root" = {
|
|
|
|
mountpoint = "/";
|
2023-10-03 11:52:44 -05:00
|
|
|
mountOptions = ["compress=zstd" "noatime"];
|
2023-09-05 15:33:20 -05:00
|
|
|
};
|
|
|
|
"/home" = {
|
|
|
|
mountpoint = "/home";
|
2023-10-03 11:52:44 -05:00
|
|
|
mountOptions = ["compress=zstd" "noatime"];
|
2023-09-05 15:33:20 -05:00
|
|
|
};
|
|
|
|
"/nix" = {
|
|
|
|
mountpoint = "/nix";
|
2023-10-03 11:52:44 -05:00
|
|
|
mountOptions = ["compress=zstd" "noatime"];
|
2023-09-05 15:33:20 -05:00
|
|
|
};
|
|
|
|
};
|
|
|
|
};
|
|
|
|
};
|
|
|
|
};
|
|
|
|
};
|
|
|
|
};
|
|
|
|
};
|
|
|
|
};
|
|
|
|
};
|
|
|
|
};
|
2023-10-03 11:52:44 -05:00
|
|
|
unencrypted = {disks ? ["/dev/vda"], ...}: {
|
2023-09-05 15:33:20 -05:00
|
|
|
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";
|
2023-10-03 11:52:44 -05:00
|
|
|
extraArgs = ["-f"];
|
2023-09-05 15:33:20 -05:00
|
|
|
subvolumes = {
|
|
|
|
"/root" = {
|
|
|
|
mountpoint = "/";
|
2023-10-03 11:52:44 -05:00
|
|
|
mountOptions = [];
|
2023-09-05 15:33:20 -05:00
|
|
|
};
|
|
|
|
"/home" = {
|
|
|
|
mountpoint = "/home";
|
2023-10-03 11:52:44 -05:00
|
|
|
mountOptions = ["compress=zstd"];
|
2023-09-05 15:33:20 -05:00
|
|
|
};
|
|
|
|
"/nix" = {
|
|
|
|
mountpoint = "/nix";
|
2023-10-03 11:52:44 -05:00
|
|
|
mountOptions = ["compress=zstd" "noatime"];
|
2023-09-05 15:33:20 -05:00
|
|
|
};
|
|
|
|
};
|
|
|
|
};
|
|
|
|
};
|
|
|
|
};
|
|
|
|
};
|
|
|
|
};
|
|
|
|
};
|
|
|
|
};
|
|
|
|
};
|
2023-10-06 10:42:19 -05:00
|
|
|
legacy = {disks ? ["/dev/vda"], ...}: {
|
|
|
|
disko.devices = {
|
|
|
|
disk = {
|
|
|
|
primary = {
|
|
|
|
device = builtins.elemAt disks 0;
|
|
|
|
type = "disk";
|
|
|
|
content = {
|
|
|
|
type = "table";
|
|
|
|
format = "gpt";
|
|
|
|
partitions = [
|
|
|
|
{
|
|
|
|
name = "ESP";
|
|
|
|
start = "1M";
|
|
|
|
end = "500M";
|
|
|
|
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 = "/";
|
|
|
|
};
|
|
|
|
}
|
|
|
|
];
|
|
|
|
};
|
|
|
|
};
|
|
|
|
};
|
|
|
|
};
|
|
|
|
};
|
2023-09-05 15:33:20 -05:00
|
|
|
}
|