From 033a9e582c6b86d2e5730bb4812f7f06124f9c74 Mon Sep 17 00:00:00 2001 From: David Crompton Date: Mon, 21 Jul 2025 19:01:32 -0400 Subject: [PATCH] hippocampus: backups: clear old gitea backups --- machines/hippocampus/backups/gitea.nix | 20 +++++++++++++++++++- 1 file changed, 19 insertions(+), 1 deletion(-) 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; + }; + }; }