summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-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)));
};
}