summaryrefslogtreecommitdiff
path: root/modules/timer-clean-backups.nix
blob: 208ac6f439d6365eadc192382da43666b90beb61 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
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";
    };
  };
}