diff options
author | makefu <github@syntax-fehler.de> | 2017-07-23 10:23:40 +0200 |
---|---|---|
committer | makefu <github@syntax-fehler.de> | 2017-07-23 10:23:40 +0200 |
commit | 3ee48434e3282ccd2b6ad83dd6c0d6552a54b71d (patch) | |
tree | 6c9c0cc04db334cbff93e97fd2f4b0702fdfd1b4 /krebs/3modules/backup.nix | |
parent | 20d5077ba6f67ea0b73345248f048eafda6548e4 (diff) | |
parent | 54a594dc474255b24bbff80bb6be28e6a1a523d4 (diff) |
Merge branch 'master' of prism:stockholm
Diffstat (limited to 'krebs/3modules/backup.nix')
-rw-r--r-- | krebs/3modules/backup.nix | 16 |
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 { |