Adding the hostname.domain and localhost.domain to hosts, if possible.
Postfix likes this. svn path=/nixos/trunk/; revision=30362
This commit is contained in:
parent
578f83eef4
commit
de5eedb612
|
@ -2,7 +2,9 @@
|
|||
|
||||
{config, pkgs, ...}:
|
||||
|
||||
with pkgs.lib;
|
||||
let
|
||||
cfg = config.networking;
|
||||
|
||||
options = {
|
||||
|
||||
|
@ -16,6 +18,13 @@ let
|
|||
|
||||
};
|
||||
|
||||
localhostWithDomain = optionalString (cfg.domain != "")
|
||||
"localhost.${cfg.domain}";
|
||||
|
||||
hostnameWithDomain = optionalString
|
||||
(cfg.domain != "" && cfg.hostName != "")
|
||||
"${cfg.hostName}.${cfg.domain}";
|
||||
|
||||
in
|
||||
|
||||
{
|
||||
|
@ -40,11 +49,10 @@ in
|
|||
{ # /etc/hosts: Hostname-to-IP mappings.
|
||||
source = pkgs.writeText "hosts"
|
||||
''
|
||||
${config.networking.extraHosts}
|
||||
${if config.networking.hostName != ""
|
||||
then "127.0.0.1 ${config.networking.hostName}"
|
||||
else ""}
|
||||
127.0.0.1 localhost
|
||||
${cfg.extraHosts}
|
||||
${optionalString (cfg.hostName != "")
|
||||
"127.0.0.1 ${cfg.hostName} ${hostnameWithDomain}"}
|
||||
127.0.0.1 localhost ${localhostWithDomain}
|
||||
'';
|
||||
target = "hosts";
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue