diff --git a/machines/hippocampus/backups/gitea.nix b/machines/hippocampus/backups/gitea.nix index 4c36208..289d378 100644 --- a/machines/hippocampus/backups/gitea.nix +++ b/machines/hippocampus/backups/gitea.nix @@ -1,6 +1,24 @@ -{ ... }: { +{ pkgs, config, ... }: { services.gitea.dump = { enable = true; interval = "2:45"; }; + systemd.timers."gitea-clear-dump" = { + wantedBy = [ "timers.target" ]; + timerConfig = { + OnCalendar = "daily"; + Persistent = true; + Unit = "gitea-clear-dump.service"; + }; + }; + + systemd.services."gitea-clear-dump" = { + script = '' + ${pkgs.findutils}/bin/find /var/lib/gitea/dump -type f -ctime +5 -exec rm -f {} \; + ''; + serviceConfig = { + Type = "oneshot"; + User = config.services.gitea.user; + }; + }; }