From 8a1ddc5e9b8012b141c3b5e997d44acb70e1f17f Mon Sep 17 00:00:00 2001 From: tv Date: Sun, 7 Feb 2016 23:48:34 +0100 Subject: krebs.backup.plans.*.enable.default = true --- krebs/3modules/backup.nix | 10 +++++++--- 1 file 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; -- cgit v1.2.3