diff options
author | nin <nineinchnade@gmail.com> | 2017-12-14 21:13:46 +0100 |
---|---|---|
committer | nin <nineinchnade@gmail.com> | 2017-12-14 21:13:46 +0100 |
commit | 37771ad34e18e0657636c8d0eb5b7392e3b89ba6 (patch) | |
tree | 8abda683b425494d2a273fc42d7573499b97a657 /krebs/3modules/zones.nix | |
parent | 7ed6fd18bb99884889a76ad9f597193861f44dc9 (diff) | |
parent | 04f7ae22d6d0720d06f78c712eb9cd245cefce82 (diff) |
Merge remote-tracking branch 'prism/master'
Diffstat (limited to 'krebs/3modules/zones.nix')
-rw-r--r-- | krebs/3modules/zones.nix | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/krebs/3modules/zones.nix b/krebs/3modules/zones.nix new file mode 100644 index 000000000..eb1351866 --- /dev/null +++ b/krebs/3modules/zones.nix @@ -0,0 +1,22 @@ +with import <stockholm/lib>; +{ config, ... }: { + + config = { + # Implements environment.etc."zones/<zone-name>" + environment.etc = let + stripEmptyLines = s: (concatStringsSep "\n" + (remove "\n" (remove "" (splitString "\n" s)))) + "\n"; + all-zones = foldAttrs (sum: current: sum + "\n" +current ) "" + ([config.krebs.zone-head-config] ++ combined-hosts); + combined-hosts = + mapAttrsToList (name: getAttr "extraZones") config.krebs.hosts; + in + mapAttrs' + (name: value: { + name = "zones/${name}"; + value.text = stripEmptyLines value; + }) + all-zones; + }; + +} |