modules/backup: fix backup times per server

This commit is contained in:
Infinidoge 2024-04-14 10:12:15 -04:00
parent c00a7d710a
commit 5e3d297d6c
Signed by: Infinidoge
SSH key fingerprint: SHA256:oAMyvotlNFraMmZmr+p6AxnNfW/GioTs1pOn3V4tQ7A

View file

@ -39,6 +39,15 @@ let
};
repo = "rsync.net:backups/hosts";
backupTimes = {
"Infini-FRAMEWORK" = "00:00";
"Infini-OPTIPLEX" = "01:00";
"Infini-SERVER" = "02:00";
"Infini-DESKTOP" = "03:00";
"Infini-SD" = "04:00";
};
in
{
users.groups."borg" = { };
@ -57,7 +66,7 @@ in
paths = "/persist";
inherit repo;
exclude = map (append paths) excludes';
startAt = "daily";
startAt = "*-*-* ${backupTimes.${config.networking.hostName}}";
prune.keep = {
within = "1d"; # Keep all archives from the last day
daily = 7;
@ -65,4 +74,8 @@ in
monthly = -1; # Keep at least one archive for each month
};
};
systemd.timers."borgbackup-job-persist" = {
requires = [ "network-online.target" ];
};
}