77 lines
1.9 KiB
Nix
77 lines
1.9 KiB
Nix
|
{ disks ? [ "/dev/vdb" "/dev/vdc" ], ... }: {
|
||
|
disko.devices = {
|
||
|
# {{{ Disks
|
||
|
disk = {
|
||
|
vdb = {
|
||
|
type = "disk";
|
||
|
device = builtins.elemAt disks 0;
|
||
|
content = {
|
||
|
type = "table";
|
||
|
format = "gpt";
|
||
|
partitions = [
|
||
|
{
|
||
|
name = "ESP";
|
||
|
start = "1MiB";
|
||
|
end = "100MiB";
|
||
|
bootable = true;
|
||
|
content = {
|
||
|
type = "filesystem";
|
||
|
format = "vfat";
|
||
|
mountpoint = "/boot";
|
||
|
mountOptions = [
|
||
|
"defaults"
|
||
|
];
|
||
|
};
|
||
|
}
|
||
|
{
|
||
|
start = "100MiB";
|
||
|
end = "100%";
|
||
|
name = "primary";
|
||
|
content = {
|
||
|
type = "zfs";
|
||
|
pool = "zroot";
|
||
|
};
|
||
|
}
|
||
|
];
|
||
|
};
|
||
|
};
|
||
|
};
|
||
|
# }}}
|
||
|
# {{{ zpools
|
||
|
zpool = {
|
||
|
zroot = {
|
||
|
type = "zpool";
|
||
|
postCreateHook = ''
|
||
|
zfs snapshot zroot@blank
|
||
|
zfs set keylocation="prompt" "zroot";
|
||
|
'';
|
||
|
rootFsOptions = {
|
||
|
compression = "lz4";
|
||
|
"com.sun:auto-snapshot" = "false";
|
||
|
encryption = "aes-256-gcm";
|
||
|
keyformat = "passphrase";
|
||
|
keylocation = "file:///tmp/secret.key";
|
||
|
};
|
||
|
|
||
|
# {{{ Datasets
|
||
|
datasets = {
|
||
|
"root/persist/data" = {
|
||
|
mountpoint = "/persist/data";
|
||
|
options."com.sun:auto-snapshot" = "true";
|
||
|
};
|
||
|
"root/persist/state" = {
|
||
|
mountpoint = "/persist/state";
|
||
|
options."com.sun:auto-snapshot" = "true";
|
||
|
};
|
||
|
"root/local/nix" = { mountpoint = "/nix"; };
|
||
|
"root/local/cache" = {
|
||
|
mountpoint = "/persist/local/cache";
|
||
|
};
|
||
|
};
|
||
|
# }}}
|
||
|
};
|
||
|
};
|
||
|
};
|
||
|
# }}}
|
||
|
}
|