From f129fe34bf7fb114740f8d088e400bd74a97409f Mon Sep 17 00:00:00 2001 From: Gregor Kleen Date: Mon, 23 Apr 2018 16:06:25 +0200 Subject: Jitter backups --- custom/borgbackup.nix | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/custom/borgbackup.nix b/custom/borgbackup.nix index dc40c652..129b5e2e 100644 --- a/custom/borgbackup.nix +++ b/custom/borgbackup.nix @@ -46,6 +46,11 @@ let default = "6h"; }; + jitter = mkOption { + type = with types; nullOr str; + default = "6h"; + }; + lock = mkOption { type = types.nullOr types.str; default = "backup"; @@ -102,6 +107,7 @@ in { Persistent = false; OnBootSec = tCfg.interval; OnUnitInactiveSec = tCfg.interval; + RandomizedDelaySec = mkIf (tCfg.jitter != null) tCfg.jitter; }; }) (flatten (mapAttrsToList (target: tCfg: map (path: { inherit target path tCfg; }) tCfg.paths) cfg.targets)))) // (mapAttrs' (target: tCfg: nameValuePair "borgbackup-prune-${target}" { enable = tCfg.prune != {}; @@ -112,6 +118,7 @@ in { Persistent = false; OnBootSec = tCfg.interval; OnUnitInactiveSec = tCfg.interval; + RandomizedDelaySec = mkIf (tCfg.jitter != null) tCfg.jitter; }; }) cfg.targets); -- cgit v1.2.3