summaryrefslogtreecommitdiffstats
path: root/krebs/3modules/hosts.nix
diff options
context:
space:
mode:
authormakefu <github@syntax-fehler.de>2019-01-21 21:49:10 +0100
committermakefu <github@syntax-fehler.de>2019-01-21 21:49:10 +0100
commit8bb94c519f44ba584af4964faa42eb28a4414bc9 (patch)
tree994fc675a41f4d1a96e3cd16ccae8896b05061d6 /krebs/3modules/hosts.nix
parent93f1ce72844bf2bc63cd919c38c3323a6f8f14ef (diff)
parentbc2aedb2d0a6d22089d4f666082d440e4ffb07e6 (diff)
Merge remote-tracking branch 'lass/master'
Diffstat (limited to 'krebs/3modules/hosts.nix')
-rw-r--r--krebs/3modules/hosts.nix25
1 files changed, 12 insertions, 13 deletions
diff --git a/krebs/3modules/hosts.nix b/krebs/3modules/hosts.nix
index a95557b3d..0985bb539 100644
--- a/krebs/3modules/hosts.nix
+++ b/krebs/3modules/hosts.nix
@@ -13,24 +13,23 @@ in {
};
config = {
- networking.extraHosts =
- concatStringsSep
- "\n"
- (flatten
- (mapAttrsToList
- (hostname: host:
- mapAttrsToList
- (netname: net: let
+ networking.hosts =
+ filterAttrs
+ (_name: value: value != [])
+ (zipAttrsWith
+ (_: concatLists)
+ (concatMap
+ (host:
+ concatMap
+ (net: let
aliases = longs ++ shorts;
longs = filter check net.aliases;
shorts = let s = ".${config.krebs.dns.search-domain}"; in
map (removeSuffix s) (filter (hasSuffix s) longs);
in
- optionals
- (aliases != [])
- (map (addr: "${addr} ${toString aliases}") net.addrs))
- (filterAttrs (name: host: host.aliases != []) host.nets))
- config.krebs.hosts));
+ map (addr: { ${addr} = aliases; }) net.addrs)
+ (attrValues host.nets))
+ (attrValues config.krebs.hosts)));
};
}