Files
homelab-config/nixos/disk-config.nix
T

72 lines
1.7 KiB
Nix
Raw Normal View History

2025-04-27 14:53:57 -05:00
{ disks ? [ "/dev/nvme0n1" ], ... }:
2025-04-09 15:27:53 -05:00
{
disko.devices = {
2025-04-09 15:55:54 -05:00
disk = {
2025-04-27 14:53:57 -05:00
x = {
device = builtins.elemAt disks 0;
2025-04-09 15:55:54 -05:00
type = "disk";
content = {
2025-04-27 14:53:57 -05:00
type = "table";
format = "gpt";
2025-04-09 15:55:54 -05:00
partitions = {
2025-04-27 14:53:57 -05:00
# boot
2025-04-09 15:55:54 -05:00
ESP = {
2025-04-27 14:53:57 -05:00
start = "1MiB";
end = "500MiB";
bootable = true;
2025-04-09 15:55:54 -05:00
content = {
type = "filesystem";
format = "vfat";
mountpoint = "/boot";
};
2025-04-09 15:27:53 -05:00
};
2025-04-27 14:53:57 -05:00
# root
zfs = {
2025-04-09 15:55:54 -05:00
size = "100%";
content = {
2025-04-27 14:53:57 -05:00
type = "zfs";
pool = "zroot";
2025-04-09 15:55:54 -05:00
};
2025-04-09 15:27:53 -05:00
};
};
};
};
};
2025-04-27 14:53:57 -05:00
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 = {
2025-04-27 14:59:10 -05:00
"root" = {
type = "zfs_fs";
options.mountpoint = "/";
mountpoint = "/";
};
2025-04-27 14:53:57 -05:00
"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";
};
};
};
};
2025-04-09 15:27:53 -05:00
};
}