about summary refs log tree commit diff
diff options
context:
space:
mode:
authorsefidel <contact@sefidel.net>2023-08-02 10:07:19 +0900
committersefidel <contact@sefidel.net>2023-08-02 10:32:59 +0900
commit718a92694e822106c66bba8a106f042e1ffa6afe (patch)
tree36c15013eb59cd2f674ca26dc364463641d50e09
parent1366799fa7c35bdce89a0fa5ce662fd8fdefbe7e (diff)
downloadinfra-718a92694e822106c66bba8a106f042e1ffa6afe.tar.gz
infra-718a92694e822106c66bba8a106f042e1ffa6afe.zip
feat(services/backup): setup auto prune
-rw-r--r--modules/services/backup.nix6
1 files changed, 6 insertions, 0 deletions
diff --git a/modules/services/backup.nix b/modules/services/backup.nix
index a513d18..41d2329 100644
--- a/modules/services/backup.nix
+++ b/modules/services/backup.nix
@@ -59,6 +59,12 @@ in
     services.borgbackup.jobs.${cfg.name} = {
       inherit (cfg) paths exclude repo;
 
+      prune.keep = {
+        within = "1d"; # Keep all archives from the last day
+        daily = 7;
+        weekly = 4;
+        monthly = 3;
+      };
 
       encryption.mode = "repokey-blake2";
       encryption.passCommand = "cat ${cfg.repoKeyPath}";