summaryrefslogtreecommitdiffstats
path: root/krebs/3modules
diff options
context:
space:
mode:
authortv <tv@krebsco.de>2016-02-06 15:57:43 +0100
committertv <tv@krebsco.de>2016-02-06 15:57:43 +0100
commita1f7f5e510ddc7a35bebe4ec7698e19d83d57c3f (patch)
treed15f7ffde80a6b146088b76bf3a1c5fc54e751b8 /krebs/3modules
parentdf89fb7e9121d395357885e00a24a616eb1fef57 (diff)
krebs: DRY up shorts of the networking.extraHosts generator
Diffstat (limited to 'krebs/3modules')
-rw-r--r--krebs/3modules/default.nix6
1 files changed, 2 insertions, 4 deletions
diff --git a/krebs/3modules/default.nix b/krebs/3modules/default.nix
index 7418434ea..20eb944e2 100644
--- a/krebs/3modules/default.nix
+++ b/krebs/3modules/default.nix
@@ -103,10 +103,8 @@ let
aliases = longs ++ shorts;
providers = dns.split-by-provider net.aliases cfg.dns.providers;
longs = providers.hosts;
- shorts =
- map (removeSuffix ".${cfg.search-domain}")
- (filter (hasSuffix ".${cfg.search-domain}")
- longs);
+ shorts = let s = ".${cfg.search-domain}"; in
+ map (removeSuffix s) (filter (hasSuffix s) longs);
in
map (addr: "${addr} ${toString aliases}") net.addrs
) (filterAttrs (name: host: host.aliases != []) host.nets)