add a prune timer to the backup server

This commit is contained in:
Andreas Zweili 2022-02-28 15:10:58 +01:00
parent d65f4dcb31
commit 47c794b59e
1 changed files with 21 additions and 0 deletions

View File

@ -17,4 +17,25 @@ in
extraFlags = [ "--no-auth" ];
};
networking.firewall.allowedTCPPorts = [ 8000 ];
systemd.services.prune-restic = {
serviceConfig.Type = "oneshot";
script = ''
${pkgs.restic}/bin/restic \
--repo ${repository} \
--password-file "/home/${custom.username}/.nixos/secrets/passwords/restic.key" \
forget \
--keep-daily 7 \
--keep-weekly 5 \
--keep-monthly 12 \
--keep-yearly 75 \
--prune
'';
};
systemd.timers.prune-restic = {
wantedBy = [ "timers.target" ];
partOf = [ "prune-restic.service" ];
timerConfig.OnCalendar = [ "*-*-* 12:00:00" ];
};
}