summaryrefslogtreecommitdiff
path: root/modules/timer-clean-backups.nix
diff options
context:
space:
mode:
Diffstat (limited to 'modules/timer-clean-backups.nix')
-rw-r--r--modules/timer-clean-backups.nix23
1 files changed, 23 insertions, 0 deletions
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";
+ };
+ };
+}