diff options
author | Jan Malakhovski <oxij@oxij.org> | 2018-09-23 15:55:39 +0000 |
---|---|---|
committer | Jan Malakhovski <oxij@oxij.org> | 2018-10-02 23:58:36 +0000 |
commit | c57892462bf22e537a2cd5ee5e6f88b0b59a2d33 (patch) | |
tree | f8502e5192461a3a6bf413c2e08eea8a5f76e4e7 /nixos/modules/config/networking.nix | |
parent | 1ece5041a465c2372f15c85541220ac20d6d698e (diff) | |
download | nixlib-c57892462bf22e537a2cd5ee5e6f88b0b59a2d33.tar nixlib-c57892462bf22e537a2cd5ee5e6f88b0b59a2d33.tar.gz nixlib-c57892462bf22e537a2cd5ee5e6f88b0b59a2d33.tar.bz2 nixlib-c57892462bf22e537a2cd5ee5e6f88b0b59a2d33.tar.lz nixlib-c57892462bf22e537a2cd5ee5e6f88b0b59a2d33.tar.xz nixlib-c57892462bf22e537a2cd5ee5e6f88b0b59a2d33.tar.zst nixlib-c57892462bf22e537a2cd5ee5e6f88b0b59a2d33.zip |
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.
Diffstat (limited to 'nixos/modules/config/networking.nix')
-rw-r--r-- | nixos/modules/config/networking.nix | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/nixos/modules/config/networking.nix b/nixos/modules/config/networking.nix index a1ee6a4304ac..1eb6fb43604a 100644 --- a/nixos/modules/config/networking.nix +++ b/nixos/modules/config/networking.nix @@ -215,6 +215,8 @@ in networking.hosts = { "127.0.0.1" = [ "localhost" ]; + } // optionalAttrs (cfg.hostName != "") { + "127.0.1.1" = [ cfg.hostName ]; } // optionalAttrs cfg.enableIPv6 { "::1" = [ "localhost" ]; }; |