zones module: init (import from default.nix)
This commit is contained in:
parent
05bc20b893
commit
8f785237b2
@ -44,6 +44,7 @@ let
|
|||||||
./tinc_graphs.nix
|
./tinc_graphs.nix
|
||||||
./urlwatch.nix
|
./urlwatch.nix
|
||||||
./repo-sync.nix
|
./repo-sync.nix
|
||||||
|
./zones.nix
|
||||||
];
|
];
|
||||||
options.krebs = api;
|
options.krebs = api;
|
||||||
config = lib.mkIf cfg.enable imp;
|
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
|
krebs.exim-smarthost.internet-aliases = let
|
||||||
format = from: to: {
|
format = from: to: {
|
||||||
inherit from;
|
inherit from;
|
||||||
|
22
krebs/3modules/zones.nix
Normal file
22
krebs/3modules/zones.nix
Normal file
@ -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;
|
||||||
|
};
|
||||||
|
|
||||||
|
}
|
Loading…
Reference in New Issue
Block a user