84 lines
2.1 KiB
Nix
84 lines
2.1 KiB
Nix
{
|
|
config,
|
|
lib,
|
|
pkgs,
|
|
...
|
|
}:
|
|
{
|
|
boot = {
|
|
zfs.extraPools = [ "ZFS-primary" ];
|
|
filesystem = "zfs";
|
|
extraModprobeConfig = ''
|
|
options zfs zfs_arc_min=82463372083
|
|
options zfs zfs_arc_max=192414534860
|
|
'';
|
|
};
|
|
|
|
services = {
|
|
zfs = {
|
|
trim.enable = true;
|
|
autoScrub.enable = true;
|
|
};
|
|
|
|
sanoid = {
|
|
enable = true;
|
|
|
|
datasets = {
|
|
"ZFS-primary/attic".useTemplate = [ "nix-prod" ];
|
|
"ZFS-primary/backups".useTemplate = [ "production" ];
|
|
"ZFS-primary/calibre".useTemplate = [ "production" ];
|
|
"ZFS-primary/db".useTemplate = [ "production" ];
|
|
"ZFS-primary/docker".useTemplate = [ "production" ];
|
|
"ZFS-primary/hydra".useTemplate = [ "nix-prod" ];
|
|
"ZFS-primary/nextcloud".useTemplate = [ "production" ];
|
|
# all docker containers should have a bind mount if they expect lasting zfs snapshots
|
|
"ZFS-primary/vardocker".useTemplate = [ "nix-prod" ];
|
|
"ZFS-primary/minio".useTemplate = [ "nix-prod" ];
|
|
"ZFS-primary/games" = {
|
|
useTemplate = [ "games" ];
|
|
recursive = true;
|
|
processChildrenOnly = true;
|
|
};
|
|
};
|
|
|
|
templates = {
|
|
# full resiliency
|
|
production = {
|
|
frequently = 0;
|
|
hourly = 36;
|
|
daily = 30;
|
|
weekly = 0;
|
|
monthly = 6;
|
|
yearly = 3;
|
|
autosnap = true;
|
|
autoprune = true;
|
|
};
|
|
# some resiliency, but not much
|
|
# common option for things like nix store and attic where there is
|
|
# already a lot of resiliency built in
|
|
nix-prod = {
|
|
frequently = 4;
|
|
hourly = 24;
|
|
daily = 7;
|
|
weekly = 0;
|
|
monthly = 0;
|
|
yearly = 0;
|
|
autosnap = true;
|
|
autoprune = true;
|
|
};
|
|
# much shorter lived than others
|
|
games = {
|
|
frequently = 6;
|
|
hourly = 36;
|
|
daily = 3;
|
|
weekly = 0;
|
|
monthly = 0;
|
|
yearly = 0;
|
|
autosnap = true;
|
|
autoprune = true;
|
|
};
|
|
};
|
|
};
|
|
};
|
|
}
|