108 lines
2.2 KiB
Nix
108 lines
2.2 KiB
Nix
{
|
|
main ? throw "Primary device not defined",
|
|
extras ? [],
|
|
size ? "100%",
|
|
...
|
|
}: let
|
|
mainDisk = {
|
|
main = {
|
|
device = main;
|
|
type = "disk";
|
|
content = {
|
|
type = "gpt";
|
|
partitions = {
|
|
boot = {
|
|
name = "boot";
|
|
size = "3M";
|
|
type = "EF02";
|
|
};
|
|
esp = {
|
|
name = "ESP";
|
|
size = "512M";
|
|
type = "EF00";
|
|
content = {
|
|
type = "filesystem";
|
|
format = "vfat";
|
|
mountpoint = "/boot";
|
|
};
|
|
};
|
|
swap = {
|
|
size = "32G";
|
|
content = {
|
|
type = "swap";
|
|
resumeDevice = true;
|
|
};
|
|
};
|
|
root = {
|
|
name = "root";
|
|
size = size;
|
|
content = {
|
|
type = "zfs";
|
|
pool = "zroot";
|
|
};
|
|
};
|
|
};
|
|
};
|
|
};
|
|
};
|
|
extraDisks = builtins.listToAttrs (map (d: {
|
|
name = d;
|
|
value = {
|
|
device = d;
|
|
type = "disk";
|
|
content = {
|
|
type = "gpt";
|
|
partitions = {
|
|
root = {
|
|
name = "root";
|
|
size = "100%";
|
|
content = {
|
|
type = "zfs";
|
|
pool = "zroot";
|
|
};
|
|
};
|
|
};
|
|
};
|
|
};
|
|
})
|
|
extras);
|
|
in {
|
|
disko.devices = {
|
|
disk = mainDisk // extraDisks;
|
|
zpool = {
|
|
zroot = {
|
|
type = "zpool";
|
|
rootFsOptions = {
|
|
compression = "zstd";
|
|
canmount = "off";
|
|
"com.sun:auto-snapshot" = "false";
|
|
};
|
|
|
|
datasets = {
|
|
root = {
|
|
type = "zfs_fs";
|
|
mountpoint = "/";
|
|
options = {
|
|
relatime = "on";
|
|
};
|
|
};
|
|
persist = {
|
|
type = "zfs_fs";
|
|
mountpoint = "/persist";
|
|
options = {
|
|
mountpoint = "legacy";
|
|
relatime = "on";
|
|
};
|
|
};
|
|
nix = {
|
|
type = "zfs_fs";
|
|
mountpoint = "/nix";
|
|
options = {
|
|
atime = "off";
|
|
};
|
|
};
|
|
};
|
|
};
|
|
};
|
|
};
|
|
}
|