krebs backup: extend api with timerConfig
This commit is contained in:
parent
dc183f8b23
commit
54a594dc47
@ -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 {
|
||||
|
Loading…
Reference in New Issue
Block a user