Fix resolving FQDN when resolved is enabled

This commit is contained in:
Simon Bruder 2024-02-24 19:18:50 +01:00
parent 3816e6fc5d
commit a9f86e7ced
Signed by: simon
GPG key ID: 347FF8699CDA0776

View file

@ -167,5 +167,15 @@
(lib.mkIf (!config.sbruder.full) {
documentation.enable = lib.mkDefault false;
})
(lib.mkIf (config.services.resolved.enable) {
# With NixOSs 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" ];
})
];
}