From c99480b357308a008b9ccdcac2cae629539f6f9f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Motiejus=20Jak=C5=A1tys?= Date: Thu, 26 Jan 2023 10:57:45 -0800 Subject: [PATCH] borg: prune + more frequent copies --- configuration.nix | 17 +++++++++++++---- 1 file changed, 13 insertions(+), 4 deletions(-) diff --git a/configuration.nix b/configuration.nix index 717072c..05e35b9 100644 --- a/configuration.nix +++ b/configuration.nix @@ -34,13 +34,16 @@ let "/var/lib/.snapshot-latest/gitea" "/var/lib/.snapshot-latest/headscale" ]; - backup_at = "*-*-* 00:05:00"; + backup_at = "*-*-* *:01:00"; }; var_log = { mountpoint = "/var/log"; zfs_name = "rpool/nixos/var/log"; paths = [ "/var/log/.snapshot-latest/" ]; - patterns = [ "+ caddy/access-beta.jakstys.lt.log-*.zst" ]; + patterns = [ + "+ caddy/access-beta.jakstys.lt.log-*.zst" + "- *" + ]; backup_at = "*-*-* 00:10:00"; }; }; @@ -164,7 +167,7 @@ in { name = name; value = { doInit = true; - repo = "zh2769@zh2769.rsync.net:hel1-a.servers.jakst"; + repo = "zh2769@zh2769.rsync.net:borg"; encryption = { mode = "repokey-blake2"; passCommand = "cat /var/src/secrets/borgbackup/password"; @@ -172,10 +175,16 @@ in { paths = value.paths; extraArgs = "--remote-path=borg1"; compression = "auto,lzma"; - startAt = "*-*-* 00:05:00"; + startAt = value.backup_at; readWritePaths = [ rwpath ]; preHook = mountLatest snapshot; postHook = umountLatest snapshot; + prune.keep = { + within = "1d"; + daily = 7; + weekly = 4; + monthly = 3; + }; } // lib.optionalAttrs (value ? patterns) { patterns = value.patterns; };