From a9f86e7cedc66bf90d55fad04a985ad93eb6cdf9 Mon Sep 17 00:00:00 2001 From: Simon Bruder Date: Sat, 24 Feb 2024 19:18:50 +0100 Subject: [PATCH] Fix resolving FQDN when resolved is enabled --- modules/default.nix | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/modules/default.nix b/modules/default.nix index 6a9d075..9a4cbb6 100644 --- a/modules/default.nix +++ b/modules/default.nix @@ -167,5 +167,15 @@ (lib.mkIf (!config.sbruder.full) { documentation.enable = lib.mkDefault false; }) + (lib.mkIf (config.services.resolved.enable) { + # With NixOS’s default database order for hosts, + # resolving the FQDN with hostname -f always returns “localhost” + # when resolved is enabled. + # This changes the priority of the files database, + # which fixes this. + # This workaround was taken from + # https://github.com/NixOS/nixpkgs/issues/132646#issuecomment-1782684381 + system.nssDatabases.hosts = lib.mkOrder 500 [ "files" ]; + }) ]; }