Files
homelab-config/nixos/disk-config.nix
T
2025-04-27 14:59:10 -05:00

72 lines
1.7 KiB
Nix

{ disks ? [ "/dev/nvme0n1" ], ... }:
{
disko.devices = {
disk = {
x = {
device = builtins.elemAt disks 0;
type = "disk";
content = {
type = "table";
format = "gpt";
partitions = {
# boot
ESP = {
start = "1MiB";
end = "500MiB";
bootable = true;
content = {
type = "filesystem";
format = "vfat";
mountpoint = "/boot";
};
};
# root
zfs = {
size = "100%";
content = {
type = "zfs";
pool = "zroot";
};
};
};
};
};
};
zpool = {
zroot = {
type = "zpool";
mode = "mirror";
options.cachefile = "none";
rootFsOptions = {
compression = "zstd";
"com.sun:auto-snapshot" = "false";
};
postCreateHook = "zfs list -t snapshot -H -o name | grep -E '^zroot@blank$' || zfs snapshot zroot@blank";
datasets = {
"root" = {
type = "zfs_fs";
options.mountpoint = "/";
mountpoint = "/";
};
"nix" = {
type = "zfs_fs";
options.mountpoint = "/local/nix";
mountpoint = "/local/nix";
};
"home" = {
type = "zfs_fs";
options.mountpoint = "/safe/home";
mountpoint = "/safe/home";
};
"persist" = {
type = "zfs_fs";
options.mountpoint = "/safe/persist";
mountpoint = "/safe/persist";
};
};
};
};
};
}