-
-
Notifications
You must be signed in to change notification settings - Fork 13.9k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
nixos: write our hostname to /etc/hosts #18183
Conversation
@peterhoeg, thanks for your PR! By analyzing the annotation information on this pull request, we identified @edolstra, @ardumont and @wkennington to be potential reviewers |
It's the job of |
I have this in
So maybe it's because the |
@peterhoeg we've done similar discovery in #16754 (comment) |
@edolstra , Would you be open to working around it by adding the hostname to |
I'm not sure if In any case, the workaround would completely break nss_myhostname for everybody (since |
I think I found a bug: glibc seems not read /etc/nsswitch.conf at all:
The output should actually be more like this:
Update maybe this is because of nscd? |
At least in the NSCD-disabled case the relevant NSS modules definitely don't get loaded, as glibc doesn't know where to look:
I wonder if we should patch glibc to search for NSS modules from an impure location (e.g. |
Yes. I can confirm that glibc cannot find the required nss module. Just an idea: Cannot every glibc derivation have their own writable directory inside |
@@ -10,6 +10,22 @@ let | |||
inherit (config.services.samba) nsswins; | |||
ldap = (config.users.ldap.enable && config.users.ldap.nsswitch); | |||
|
|||
hostArray = with lib; [ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
with lib;
is unnecessary here.
myhostname and mymachines should work again because #21175 was merged. |
Thanks. merged - but fixed order of mdns modules. |
Motivation for this change
The fqdn of the machine should always be resolvable.
networking.hostName = "f.q.d.n";
hostname --fqdn
hostname: Name or service not known
I addition to the
hostname
command, other software that wants to look up the name will also fail without with something like:This PR writes out the hostName to /etc/hosts so it is always resolvable.
Additionally, we need to keep it on 2 lines, as
hostname --fqdn
will otherwise returnlocalhost
instead of the actual name.I'm not enough of a network guru to see if there are any downsides to this...
Things done
(nix.useChroot on NixOS,
or option
build-use-chroot
innix.conf
on non-NixOS)
nix-shell -p nox --run "nox-review wip"
./result/bin/
)