clan/modules/zfs_unencrypted.nix

73 lines
1.9 KiB
Nix

{...}: let
suffix = "ec39b1a05fa0435186d503ca901baac0";
in {
boot.loader.systemd-boot.enable = true;
disko.devices = {
disk = {
"main" = {
# suffix is to prevent disk name collisions
name = "main-" + suffix;
type = "disk";
# Set the following in flake.nix for each maschine:
# device = <uuid>;
content = {
type = "gpt";
partitions = {
"boot" = {
size = "1M";
type = "EF02"; # for grub MBR
priority = 1;
};
"ESP" = {
size = "512M";
type = "EF00";
content = {
type = "filesystem";
format = "vfat";
mountpoint = "/boot";
mountOptions = ["nofail"];
};
};
"zfs" = {
size = "100%";
content = {
type = "zfs";
pool = "zroot";
};
};
};
};
};
};
zpool = {
zroot = {
type = "zpool";
# Workaround: cannot import 'zroot': I/O error in disko tests
options.cachefile = "none";
rootFsOptions = {
compression = "zstd";
"com.sun:auto-snapshot" = "false";
};
mountpoint = "/";
postCreateHook = "zfs list -t snapshot -H -o name | grep -E '^zroot@blank$' || zfs snapshot zroot@blank";
datasets = {
nix = {
type = "zfs_fs";
mountpoint = "/nix";
};
srv = {
type = "zfs_fs";
mountpoint = "/srv";
options."com.sun:auto-snapshot" = "true";
};
home = {
type = "zfs_fs";
mountpoint = "/home";
options."com.sun:auto-snapshot" = "true";
};
};
};
};
};
}