summaryrefslogtreecommitdiffstats
path: root/krebs/3modules
diff options
context:
space:
mode:
authortv <tv@krebsco.de>2016-02-07 23:48:34 +0100
committertv <tv@krebsco.de>2016-02-07 23:48:34 +0100
commit8a1ddc5e9b8012b141c3b5e997d44acb70e1f17f (patch)
treefda2ac95f27dd481db2770942e879cf749fea2c7 /krebs/3modules
parent071194c3946b325103311f5c6528fba30580f125 (diff)
krebs.backup.plans.*.enable.default = true
Diffstat (limited to 'krebs/3modules')
-rw-r--r--krebs/3modules/backup.nix10
1 files changed, 7 insertions, 3 deletions
diff --git a/krebs/3modules/backup.nix b/krebs/3modules/backup.nix
index fa5b0cfd2..6e9e9813c 100644
--- a/krebs/3modules/backup.nix
+++ b/krebs/3modules/backup.nix
@@ -13,8 +13,10 @@ let
plans = mkOption {
default = {};
type = types.attrsOf (types.submodule ({ config, ... }: {
- # TODO enable = mkEnableOption "TODO" // { default = true; };
options = {
+ enable = mkEnableOption "krebs.backup.${config.name}" // {
+ default = true;
+ };
method = mkOption {
type = types.enum ["pull" "push"];
};
@@ -78,7 +80,7 @@ let
inherit (plan) startAt;
}) (filter (plan: build-host-is "pull" "dst" plan ||
build-host-is "push" "src" plan)
- (attrValues cfg.plans)));
+ enabled-plans));
users.groups.backup.gid = genid "backup";
users.users.root.openssh.authorizedKeys.keys =
@@ -87,9 +89,11 @@ let
pull = plan.dst.host.ssh.pubkey;
}) (filter (plan: build-host-is "pull" "src" plan ||
build-host-is "push" "dst" plan)
- (attrValues cfg.plans));
+ enabled-plans);
};
+ enabled-plans = filter (getAttr "enable") (attrValues cfg.plans);
+
build-host-is = method: side: plan:
plan.method == method &&
config.krebs.build.host.name == plan.${side}.host.name;