clan/machines/moritz-server/yottamaster.nix

62 lines
1.6 KiB
Nix

{
lib,
...
}: let
suffix = "ec39b1a05fa0435186d503ca901baac0";
in {
boot.loader.systemd-boot.enable = true;
disko.devices = {
disk = let
disks = ["/dev/disk/by-id/usb-JMicron_Generic_DISK00_0123456789ABCDEF-0:0" "/dev/disk/by-id/usb-JMicron_Generic_DISK01_0123456789ABCDEF-0:1"];
mkDisk = name: device: {
inherit device;
# suffix is to prevent disk name collisions
name = name + "-" + suffix;
type = "disk";
content = {
type = "gpt";
partitions = {
"zfs" = {
size = "100%";
content = {
type = "zfs";
pool = "yottamaster";
};
};
};
};
};
kv =
lib.imap0 (i: v: rec {
name = "yottamaster" + builtins.toString i;
value = mkDisk name v;
})
disks;
in
builtins.listToAttrs kv;
zpool = {
yottamaster = {
type = "zpool";
mode = "mirror";
# Workaround: cannot import 'zroot': I/O error in disko tests
options.cachefile = "none";
rootFsOptions = {
compression = "zstd";
"com.sun:auto-snapshot" = "false";
};
datasets = {
music = {
type = "zfs_fs";
mountpoint = "/music";
options."com.sun:auto-snapshot" = "true";
nixarr = {
type = "zfs_fs";
mountpoint = "/data/nixarr";
options."com.sun:auto-snapshot" = "true";
};
};
};
};
};
}