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 = "hosts".text =
let oneToString = set : ip : ip + " " + concatStringsSep " " ( getAttr ip set ); let oneToString = set : ip : ip + " " + concatStringsSep " " ( getAttr ip set );
allToString = set : concatStringsSep "\n" ( map ( oneToString set ) ( builtins.attrNames set )); allToString = set : concatStringsSep "\n" ( map ( oneToString set ) ( builtins.attrNames set ));
userLocalHosts = userLocalHosts = optionalString
if builtins.hasAttr "127.0.0.1" cfg.hosts ( builtins.hasAttr "127.0.0.1" cfg.hosts )
then concatStringsSep " " ( filter (x : x != "localhost" ) ( getAttr "127.0.0.1" cfg.hosts)) ( concatStringsSep " " ( filter (x : x != "localhost" ) ( getAttr "127.0.0.1" cfg.hosts)));
else ""; userLocalHosts6 = optionalString
userLocalHosts6 = ( builtins.hasAttr "::1" cfg.hosts )
if builtins.hasAttr "::1" cfg.hosts ( concatStringsSep " " ( filter (x : x != "localhost" ) ( getAttr "::1" cfg.hosts)));
then concatStringsSep " " ( filter (x : x != "localhost" ) ( getAttr "::1" cfg.hosts))
else "";
otherHosts = allToString ( removeAttrs cfg.hosts [ "127.0.0.1" "::1" ]); 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 in
'' ''
127.0.0.1 ${maybeFQDN} ${userLocalHosts} localhost 127.0.0.1 ${maybeFQDN} ${userLocalHosts} localhost