treewide: snapshot important datasets with sanoid

This commit is contained in:
Katherina Walshe-Grey 2024-12-24 17:47:34 +00:00
parent 715b3f799a
commit 345bf13b0d
6 changed files with 55 additions and 0 deletions

View file

@ -10,6 +10,7 @@
./nginx.nix ./nginx.nix
./nix.nix ./nix.nix
./openssh.nix ./openssh.nix
./sanoid.nix
./security.nix ./security.nix
./steam.nix ./steam.nix
]; ];

35
common/sanoid.nix Normal file
View file

@ -0,0 +1,35 @@
{ config, pkgs, inputs, ... }:
{
config = {
services.sanoid = {
enable = true;
extraArgs = [ "--verbose" ];
# Local snapshots for important datasets
templates."production" = {
yearly = 0;
monthly = 3;
daily = 30;
hourly = 36;
autosnap = true;
autoprune = true;
};
# Reduced-retention version for datasets that are backed up to the NAS
templates."safe" = {
yearly = 0;
monthly = 0;
daily = 7;
hourly = 24;
autosnap = true;
autoprune = true;
};
# datasets."rpool_sggau1/reese/system" = {
# useTemplate = [ "safe" ];
# recursive = "zfs";
# };
};
};
}

View file

@ -0,0 +1,8 @@
{ config, lib, pkgs, ... }:
{
services.sanoid.datasets."rpool_albion/state" = {
useTemplate = [ "production" ];
recursive = "zfs";
};
}

View file

@ -5,6 +5,7 @@ let
in in
{ {
imports = [ imports = [
./backup.nix
./filesystems.nix ./filesystems.nix
./hardware.nix ./hardware.nix
./networking.nix ./networking.nix

View file

@ -19,6 +19,11 @@
"rpool_orm/state/actual" = { mountpoint = "/var/lib/actual"; }; "rpool_orm/state/actual" = { mountpoint = "/var/lib/actual"; };
}; };
services.sanoid.datasets."rpool_orm/state" = {
useTemplate = [ "production" ];
recursive = "zfs";
};
qenya.services.actual = { qenya.services.actual = {
enable = true; enable = true;
domain = "actual.qenya.tel"; domain = "actual.qenya.tel";

View file

@ -22,6 +22,11 @@
"rpool/state/forgejo" = { mountpoint = "/var/lib/forgejo"; }; "rpool/state/forgejo" = { mountpoint = "/var/lib/forgejo"; };
}; };
services.sanoid.datasets."rpool/state" = {
useTemplate = [ "production" ];
recursive = "zfs";
};
qenya.services.forgejo = { qenya.services.forgejo = {
enable = true; enable = true;
domain = "git.qenya.tel"; domain = "git.qenya.tel";