diff options
-rw-r--r-- | machines/owo/configuration.nix | 1 | ||||
-rw-r--r-- | modules/timer-clean-backups.nix | 23 |
2 files changed, 24 insertions, 0 deletions
diff --git a/machines/owo/configuration.nix b/machines/owo/configuration.nix index ad70179..024fe7c 100644 --- a/machines/owo/configuration.nix +++ b/machines/owo/configuration.nix @@ -8,6 +8,7 @@ "core/global.nix" "ssh.nix" "compromyse.nix" + "timer-clean-backups.nix" ]); networking.hostName = "owo"; diff --git a/modules/timer-clean-backups.nix b/modules/timer-clean-backups.nix new file mode 100644 index 0000000..208ac6f --- /dev/null +++ b/modules/timer-clean-backups.nix @@ -0,0 +1,23 @@ +{ config, lib, pkgs, ... }: + +{ + systemd.timers."clean-backups" = { + wantedBy = [ "timers.target" ]; + timerConfig = { + OnCalendar = "daily"; + Persistent = true; + Unit = "clean-backups.service"; + }; + }; + + systemd.services."clean-backups" = { + script = '' + find $HOME/backups -mtime 7 -delete + ''; + + serviceConfig = { + Type = "oneshot"; + User = "compromyse"; + }; + }; +} |