-
-
Notifications
You must be signed in to change notification settings - Fork 14.7k
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/systemd: move systemd-provided NSS modules to systemd module #86940
Conversation
# While there is already an assertion in place complaining loudly about | ||
# having nssModules configured and nscd disabled, for some reason we still | ||
# check for nscd being enabled before adding to nssModules. |
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.
@florianjacob as the author of e370e97, can you elaborate on why we silently disable these nss modules if nscd is disabled, even though there's an assertion in https://github.com/NixOS/nixpkgs/pull/86940/files#diff-5796c52b71eee35842f408f4126430d6R126-R127 which should complain if nss modules are present, but nscd disabled (so nssModules are not respected)?
Maybe instead of silently ignoring these (and breaking dynamic user support, as well as other NSS modules), can't we ask the user to mkForce system.nssModules = []
in the assertion message if they really doesn't want any external NSS modules?
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.
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.
I really like your idea. There is no reason for the current behaviour and system.nssModules = systemd.out
seems like the most elegant solution and also prevents users from accidentially breaking their systems by disabling nscd.
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.
I hope @florianjacob can shed some light on this. I think we should never have to add vague comments like for some reason we still check for nscd being enabled before adding to nssModules.
The source should be a place of truth :) If we can't figure it out and the original authors don't respond we might as well change the implementation until we encounter errors and can properly document them.
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.
Configuring systemd without the mkIf seems like a much better solution 👍
# While there is already an assertion in place complaining loudly about | ||
# having nssModules configured and nscd disabled, for some reason we still | ||
# check for nscd being enabled before adding to nssModules. |
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.
I really like your idea. There is no reason for the current behaviour and system.nssModules = systemd.out
seems like the most elegant solution and also prevents users from accidentially breaking their systems by disabling nscd.
We keep the "only add the nss module if nscd is enabled" logic for now. The assertion never was triggered, so it can be removed.
We keep the conditional on only adding if nscd is enabled for now.
I adressed your suggestions. I'll reserve the nssModules assertions for a follow-up PR. |
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.
Overall 👍 just some comments.
# While there is already an assertion in place complaining loudly about | ||
# having nssModules configured and nscd disabled, for some reason we still | ||
# check for nscd being enabled before adding to nssModules. |
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.
I hope @florianjacob can shed some light on this. I think we should never have to add vague comments like for some reason we still check for nscd being enabled before adding to nssModules.
The source should be a place of truth :) If we can't figure it out and the original authors don't respond we might as well change the implementation until we encounter errors and can properly document them.
@andir as written in #86940 (comment), I'd really prefer to make the user explicitly force However, I wanted to keep the existing behaviour while moving things around, and plan to address this in a future PR. |
@@ -138,6 +138,10 @@ in | |||
|
|||
users.users.resolved.group = "systemd-resolve"; | |||
|
|||
# add resolve to nss hosts database if enabled and nscd enabled | |||
# system.nssModules is configured in nixos/modules/system/boot/systemd.nix |
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.
This isn't enough. We need to mkOrder in such a way that we're sure dns
follows resolve
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.
dns
is still added with (mkAfter [ "dns" ])
- try nix-build nixos/tests/networking.nix --arg networkd true -A dhcpOneIf.driver && result/bin/nixos-run-vms
and cat /etc/nsswitch.conf
on the client:
cat /etc/nsswitch.conf | grep hosts
hosts: files mymachines resolve [!UNAVAIL=return] dns myhostname
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.
perfect
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.
LGTM. Let's hope we can get rid of the conditional check on nscd later.
Finally, here comes the truth regarding From today's perspective, this is indeed another silent source of errors, which I was actually trying to prevent with the assertion. Thank you @flokli for not waiting two years until I shed light on the reasons, and continuing in #87016 😅 |
Motivation for this change
#86350
Things done
sandbox
innix.conf
on non-NixOS linux)nix-shell -p nixpkgs-review --run "nixpkgs-review wip"
./result/bin/
)nix path-info -S
before and after)