nixos-nas/disko.nix
Nicole Dresselhaus f98a761db3 final-finally?
2025-06-11 19:36:41 +02:00

83 lines
2.0 KiB
Nix
Raw Permalink Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

# disko.nix Root-on-ZFS (rpool) + Daten-Pool (tank)
{ disks, ... }:
{
disko.devices = {
disk.main = {
device = builtins.elemAt disks 0;
type = "disk";
content = {
type = "gpt";
partitions = {
ESP = {
size = "1G"; type = "EF00";
content = {
type = "filesystem";
format = "vfat";
extraArgs = [ "-F32" ];
mountpoint = "/boot";
};
};
rpool = {
size = "60G";
content = { type = "zfs"; pool = "rpool"; };
};
tank = {
size = "100%";
content = { type = "zfs"; pool = "tank"; };
};
};
};
};
zpool.rpool = {
type = "zpool";
options = { ashift = "12"; autotrim = "on"; };
rootFsOptions = {
compression = "zstd";
};
postCreateHook = "zfs list -t snapshot -H -o name | grep -E '^rpool@blank$' || zfs snapshot rpool@blank";
datasets = {
root = {
type = "zfs_fs";
mountpoint = "/";
options = {
mountpoint = "legacy";
compression = "zstd";
"com.sun:auto-snapshot" = "false";
};
};
nix = {
type = "zfs_fs";
mountpoint = "/nix";
options.mountpoint = "legacy";
options.compression = "zstd";
};
};
};
zpool.tank = {
type = "zpool";
options = { ashift = "12"; autotrim = "on"; };
postCreateHook = "zfs list -t snapshot -H -o name | grep -E '^tank@blank$' || zfs snapshot tank@blank";
datasets = {
media = {
type = "zfs_fs";
mountpoint = "/tank";
options.mountpoint = "legacy";
options.compression = "zstd";
};
home = {
type = "zfs_fs";
mountpoint = "/home";
options.mountpoint = "legacy";
options.compression = "zstd";
};
};
};
};
}