83 lines
2.0 KiB
Nix
83 lines
2.0 KiB
Nix
# 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";
|
||
};
|
||
};
|
||
};
|
||
};
|
||
}
|
||
|