restic: Make restic prune regularily on fuuko

Closes #41.
pull/24/head
Simon Bruder 2021-05-28 14:54:45 +02:00
parent e9dc4601ad
commit de3f8f8909
Signed by: simon
GPG Key ID: 8D3C82F9F309F8EC
2 changed files with 21 additions and 0 deletions

View File

@ -35,6 +35,7 @@
"/data/misc"
"/data/torrent"
];
prune = true;
};
unfree.allowSoftware = true;
};

View File

@ -64,6 +64,7 @@ in
type = lib.types.nullOr lib.types.int;
default = 1500;
};
prune = lib.mkEnableOption "pruning";
};
config = lib.mkIf cfg.enable {
@ -98,6 +99,25 @@ in
"IOSchedulingPriority" = 7;
};
services.restic.backups.system-prune = lib.mkIf cfg.prune {
inherit repository;
passwordFile = config.sops.secrets.restic-password.path;
s3CredentialsFile = config.sops.secrets.restic-s3.path;
timerConfig = {
OnCalendar = "*-1/2-07 03:00:00";
RandomizedDelaySec = "4h";
};
paths = [ ];
pruneOpts = [
"--keep-daily 7"
"--keep-monthly 12"
"--keep-weekly 5"
"--keep-yearly 10"
"--tag system"
"--verbose"
] ++ lib.optional (cfg.uploadLimit != null) "--limit-upload=${toString cfg.uploadLimit}";
};
environment.systemPackages = [
authScript
];