nixos/networking: add hostname to /etc/hosts
by default
We use `127.0.1.1` instead of `127.0.0.1` because some applications will fail if `127.0.0.1` resolves to something other than `localhost`. Debian does the same. See #1248 and #36261.
This commit is contained in:
parent
1ece5041a4
commit
c57892462b
@ -215,6 +215,8 @@ in
|
|||||||
|
|
||||||
networking.hosts = {
|
networking.hosts = {
|
||||||
"127.0.0.1" = [ "localhost" ];
|
"127.0.0.1" = [ "localhost" ];
|
||||||
|
} // optionalAttrs (cfg.hostName != "") {
|
||||||
|
"127.0.1.1" = [ cfg.hostName ];
|
||||||
} // optionalAttrs cfg.enableIPv6 {
|
} // optionalAttrs cfg.enableIPv6 {
|
||||||
"::1" = [ "localhost" ];
|
"::1" = [ "localhost" ];
|
||||||
};
|
};
|
||||||
|
Loading…
Reference in New Issue
Block a user