summaryrefslogtreecommitdiffstats
path: root/krebs/3modules/backup.nix
diff options
context:
space:
mode:
Diffstat (limited to 'krebs/3modules/backup.nix')
-rw-r--r--krebs/3modules/backup.nix16
1 files changed, 15 insertions, 1 deletions
diff --git a/krebs/3modules/backup.nix b/krebs/3modules/backup.nix
index bfb0ab591..6f015d66b 100644
--- a/krebs/3modules/backup.nix
+++ b/krebs/3modules/backup.nix
@@ -54,6 +54,12 @@ let
};
});
};
+ timerConfig = mkOption {
+ type = with types; attrsOf str;
+ default = optionalAttrs (config.startAt != null) {
+ OnCalendar = config.startAt;
+ };
+ };
};
}));
};
@@ -82,11 +88,19 @@ let
SyslogIdentifier = ExecStart.name;
Type = "oneshot";
};
- startAt = mkIf (plan.startAt != null) plan.startAt;
}) (filter (plan: build-host-is "pull" "dst" plan ||
build-host-is "push" "src" plan)
enabled-plans));
+ systemd.timers =
+ listToAttrs (map (plan: nameValuePair "backup.${plan.name}" {
+ wantedBy = [ "timers.target" ];
+ timerConfig = plan.timerConfig;
+ }) (filter (plan: plan.timerConfig != {} && (
+ build-host-is "pull" "dst" plan ||
+ build-host-is "push" "src" plan))
+ enabled-plans));
+
users.groups.backup.gid = genid "backup";
users.users.root.openssh.authorizedKeys.keys =
map (plan: getAttr plan.method {