summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authortv <tv@krebsco.de>2017-11-30 22:35:04 +0100
committertv <tv@krebsco.de>2017-11-30 22:39:03 +0100
commit8f785237b2dc46c63272e360cece351b2974cb6d (patch)
treeb256cbbdb3e81c8f4cb34647e11a6d274d3d1961
parent05bc20b893ff6d441d7e8e10802134d2192e724a (diff)
zones module: init (import from default.nix)
-rw-r--r--krebs/3modules/default.nix12
-rw-r--r--krebs/3modules/zones.nix22
2 files changed, 23 insertions, 11 deletions
diff --git a/krebs/3modules/default.nix b/krebs/3modules/default.nix
index c89f3229d..a8933e719 100644
--- a/krebs/3modules/default.nix
+++ b/krebs/3modules/default.nix
@@ -44,6 +44,7 @@ let
./tinc_graphs.nix
./urlwatch.nix
./repo-sync.nix
+ ./zones.nix
];
options.krebs = api;
config = lib.mkIf cfg.enable imp;
@@ -171,17 +172,6 @@ let
'';
};
- # 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 ) ""
- ([cfg.zone-head-config] ++ combined-hosts);
- combined-hosts = (mapAttrsToList (name: value: value.extraZones) cfg.hosts );
- in lib.mapAttrs' (name: value: nameValuePair
- ("zones/" + name)
- { text=(stripEmptyLines value); }) all-zones;
-
krebs.exim-smarthost.internet-aliases = let
format = from: to: {
inherit from;
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;
+ };
+
+}