Style adjustments

Also dangerous typo fix
This commit is contained in:
Valentin Shirokov 2017-07-08 23:04:47 +03:00
parent ca54c3f1aa
commit 396db6493d

View File

@ -213,16 +213,14 @@ in
"hosts".text =
let oneToString = set : ip : ip + " " + concatStringsSep " " ( getAttr ip set );
allToString = set : concatStringsSep "\n" ( map ( oneToString set ) ( builtins.attrNames set ));
userLocalHosts =
if builtins.hasAttr "127.0.0.1" cfg.hosts
then concatStringsSep " " ( filter (x : x != "localhost" ) ( getAttr "127.0.0.1" cfg.hosts))
else "";
userLocalHosts6 =
if builtins.hasAttr "::1" cfg.hosts
then concatStringsSep " " ( filter (x : x != "localhost" ) ( getAttr "::1" cfg.hosts))
else "";
userLocalHosts = optionalString
( builtins.hasAttr "127.0.0.1" cfg.hosts )
( concatStringsSep " " ( filter (x : x != "localhost" ) ( getAttr "127.0.0.1" cfg.hosts)));
userLocalHosts6 = optionalString
( builtins.hasAttr "::1" cfg.hosts )
( concatStringsSep " " ( filter (x : x != "localhost" ) ( getAttr "::1" cfg.hosts)));
otherHosts = allToString ( removeAttrs cfg.hosts [ "127.0.0.1" "::1" ]);
maybeFQDN = if cfg.fqdn == null then "" else cfq.fqdn;
maybeFQDN = optionalString ( cfg.fqdn != null ) cfg.fqdn;
in
''
127.0.0.1 ${maybeFQDN} ${userLocalHosts} localhost