From 71c4871af07e9657b8f1af6c8034a2c858323fe6 Mon Sep 17 00:00:00 2001 From: Antoine Martin Date: Tue, 4 May 2021 01:32:37 +0200 Subject: [PATCH] boreal: prune backups older than a month --- hosts/boreal/default.nix | 8 ++++++++ services/borg-backup.nix | 18 +++++++++++++----- 2 files changed, 21 insertions(+), 5 deletions(-) diff --git a/hosts/boreal/default.nix b/hosts/boreal/default.nix index e31549c..b7ab958 100644 --- a/hosts/boreal/default.nix +++ b/hosts/boreal/default.nix @@ -47,6 +47,14 @@ in borg-backup = { enable = true; repo = secrets.borg-backup.boreal-repo; + # for a workstation, having backups spanning the last month should be + # enough + prune = { + keep = { + daily = 7; + weekly = 4; + }; + }; paths = [ "/home/alarsyo" ]; diff --git a/services/borg-backup.nix b/services/borg-backup.nix index 6c4e132..866a2af 100644 --- a/services/borg-backup.nix +++ b/services/borg-backup.nix @@ -14,6 +14,18 @@ in { description = "Borgbase repo info. Required."; }; + prune = mkOption { + type = types.attrs; + default = { + keep = { + daily = 7; + weekly = 4; + monthly = 6; + }; + }; + description = "pruning options for borg"; + }; + paths = mkOption { type = types.listOf types.str; default = []; @@ -57,11 +69,7 @@ in { doInit = true; compression = "auto,zstd"; startAt = "daily"; - prune.keep = { - daily = 7; - weekly = 4; - monthly = 6; - }; + prune = cfg.prune; }; }; }