infra/nix/hosts/loki/disko-config.nix
2026-01-05 23:09:19 +01:00

157 lines
4.1 KiB
Nix

{
config,
disks ? ["/dev/sda"],
...
}: let
zfs-DATA = config.age.secrets.zfs-DATA;
in {
disko.devices = {
disk = {
x = {
type = "disk";
device = "/dev/sda";
content = {
type = "gpt";
partitions = {
ESP = {
type = "EF00";
size = "700M";
content = {
type = "filesystem";
format = "vfat";
mountpoint = "/boot";
};
};
zfs = {
size = "100%";
content = {
type = "zfs";
pool = "zroot";
};
};
};
};
};
};
zpool = {
zroot = {
type = "zpool";
mode = ""; # == single disk
options = {
ashift = "12";
autotrim = "on";
};
rootFsOptions = {
checksum = "sha512";
compression = "zstd";
"com.sun:auto-snapshot" = "false";
};
mountpoint = null;
postCreateHook = "zfs snapshot zroot@blank";
datasets = {
"ROOT" = {
type = "zfs_fs";
mountpoint = null;
options."com.sun:auto-snapshot" = "false";
};
"ROOT/nixos" = {
type = "zfs_fs";
mountpoint = "/";
options."com.sun:auto-snapshot" = "true";
};
nix = {
type = "zfs_fs";
mountpoint = "/nix";
options."com.sun:auto-snapshot" = "true";
};
#DATA = {
# type = "zfs_fs";
# options = {
# encryption = "aes-256-gcm";
# keyformat = "passphrase";
# keylocation = "file://${zfs-DATA.path}";
# mountpoint = "none";
# "com.sun:auto-snapshot" = "true";
# };
# # postCreateHook = ''
# # zfs set keylocation="file://${zfs-DATA}.path" "zroot/$name";
# # '';
#};
"DATA/services/audiobookshelf" = {
type = "zfs_fs";
};
"DATA/services/audiobookshelf/config" = {
type = "zfs_fs";
};
"DATA/services/audiobookshelf/audiobooks" = {
type = "zfs_fs";
};
"DATA/media/Audiobooks" = {
type = "zfs_fs";
};
# TODO
"DATA/media/Podcasts" = {
type = "zfs_fs";
};
"DATA/services/adventurelog" = {
type = "zfs_fs";
};
"DATA/services/adventurelog/media" = {
type = "zfs_fs";
};
"DATA/services/adventurelog/postgis" = {
type = "zfs_fs";
};
"DATA/services/adventurelog/data" = {
type = "zfs_fs";
};
"DATA/services/stirlingpdf" = {
type = "zfs_fs";
};
"DATA/services/stirlingpdf/configs" = {
type = "zfs_fs";
};
"DATA/services/stirlingpdf/trainingData" = {
type = "zfs_fs";
};
"DATA/services/stirlingpdf/logs" = {
type = "zfs_fs";
# mountpoint = "/var/log/stirlingpdf";
};
"DATA/services/vaultwarden" = {
type = "zfs_fs";
# mountpoint = "/var/log/bitwarden_rs";
};
"DATA/services/open-webui" = {
type = "zfs_fs";
# mountpoint = "/var/lib/open-webui";
};
"DATA/services/hass" = {
type = "zfs_fs";
};
"DATA/services/hass/config" = {
type = "zfs_fs";
};
"DATA/services/graylog" = {
type = "zfs_fs";
};
"DATA/services/graylog/data" = {
type = "zfs_fs";
};
"DATA/services/opensearch" = {
type = "zfs_fs";
};
"DATA/services/mongodb" = {
type = "zfs_fs";
};
"DATA/services/grafana" = {
type = "zfs_fs";
mountpoint = "/var/lib/grafana";
};
};
};
};
};
}