summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--custom/borgbackup.nix7
1 files changed, 7 insertions, 0 deletions
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
46 default = "6h"; 46 default = "6h";
47 }; 47 };
48 48
49 jitter = mkOption {
50 type = with types; nullOr str;
51 default = "6h";
52 };
53
49 lock = mkOption { 54 lock = mkOption {
50 type = types.nullOr types.str; 55 type = types.nullOr types.str;
51 default = "backup"; 56 default = "backup";
@@ -102,6 +107,7 @@ in {
102 Persistent = false; 107 Persistent = false;
103 OnBootSec = tCfg.interval; 108 OnBootSec = tCfg.interval;
104 OnUnitInactiveSec = tCfg.interval; 109 OnUnitInactiveSec = tCfg.interval;
110 RandomizedDelaySec = mkIf (tCfg.jitter != null) tCfg.jitter;
105 }; 111 };
106 }) (flatten (mapAttrsToList (target: tCfg: map (path: { inherit target path tCfg; }) tCfg.paths) cfg.targets)))) // (mapAttrs' (target: tCfg: nameValuePair "borgbackup-prune-${target}" { 112 }) (flatten (mapAttrsToList (target: tCfg: map (path: { inherit target path tCfg; }) tCfg.paths) cfg.targets)))) // (mapAttrs' (target: tCfg: nameValuePair "borgbackup-prune-${target}" {
107 enable = tCfg.prune != {}; 113 enable = tCfg.prune != {};
@@ -112,6 +118,7 @@ in {
112 Persistent = false; 118 Persistent = false;
113 OnBootSec = tCfg.interval; 119 OnBootSec = tCfg.interval;
114 OnUnitInactiveSec = tCfg.interval; 120 OnUnitInactiveSec = tCfg.interval;
121 RandomizedDelaySec = mkIf (tCfg.jitter != null) tCfg.jitter;
115 }; 122 };
116 }) cfg.targets); 123 }) cfg.targets);
117 124