Skip to content
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/networking: do not copy /etc/rpc on non-glibc systems #49311

Closed
wants to merge 5 commits into from

Conversation

tathougies
Copy link
Contributor

Motivation for this change

Mandating using /etc/rpc from glibc means we may pull in an unnecessary dependency on non-glibc systems. This gets rid of that, allowing for alternate C libraries to provide their own in the future.

Scoped down version of #49218

Things done
  • Tested using sandboxing (nix.useSandbox on NixOS, or option sandbox in nix.conf on non-NixOS)
  • Built on platform(s)
    • NixOS
    • macOS
    • other Linux distributions
  • Tested via one or more NixOS test(s) if existing and applicable for the change (look inside nixos/tests)
  • Tested compilation of all pkgs that depend on this change using nix-shell -p nox --run "nox-review wip"
  • Tested execution of all binary files (usually in ./result/bin/)
  • Determined the impact on package closure size (by running nix path-info -S before and after)
  • Fits CONTRIBUTING.md.

@@ -251,6 +248,9 @@ in
"resolv.conf".source = "${pkgs.systemd}/lib/systemd/resolv.conf";
} // optionalAttrs (config.services.resolved.enable && dnsmasqResolve) {
"dnsmasq-resolv.conf".source = "/run/systemd/resolve/resolv.conf";
} // optionalAttrs (!pkgs.stdenv.hostPlatform.isMusl) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would put hostPlatform.libc == “glibc” to be more specific.

ldd corresponds to the ldd command on most linux systems. Right now we
have two implementations of it in glibc & musl. This should handle
both of those cases.
glibc needs /etc/rpc but apparently musl doesn’t.
These binaries are provided by glibc, but we don’t want to pull them
directly from glibc in case another libc is being used. Instead, we
can use some indirect packages that will use whatever libc you are
linking against:

- getent
- getconf
- ldd
@matthewbauer
Copy link
Member

Just pushed commits with system-path fixes.

@dtzWill
Copy link
Member

dtzWill commented Oct 29, 2018

See comment on previous PR: #49218 (comment) (probably should have posted it here instead, sorry).

Although currently AFAIK NFS doesn't work w/musl (since we upgraded it), but that shouldn't be especially hard to fix. The major blocker for many things is librsvg -> rust, which mostly needs someone to create+host a musl-based rust bootstrap tarball -- possibly starting with those available in various musl-based distributions, and applying and fixes to rust that may be needed (not sure which these are for latest versions).

@matthewbauer
Copy link
Member

Those commits I pushed might not be helpful if so definitely feel free to drop them.

Although currently AFAIK NFS doesn't work w/musl (since we upgraded it), but that shouldn't be especially hard to fix. The major blocker for many things is librsvg -> rust, which mostly needs someone to create+host a musl-based rust bootstrap tarball -- possibly starting with those available in various musl-based distributions, and applying and fixes to rust that may be needed (not sure which these are for latest versions).

This should just effect native built Musl though right? The cross built stuff should be able to cross compile librsvg (someone was working on cross support for rust recently). Not to completely discourage the effort of getting Rust-based Musl bootstrap but it can become a maintenance burden over time. We have a couple of self-hosted compilers in Nixpkgs now and I'm hoping we can find a better solution than making double bootstrap tools for each one.

@@ -9739,6 +9739,12 @@ with pkgs;

libcCross = assert stdenv.targetPlatform != stdenv.buildPlatform; libcCrossChooser stdenv.targetPlatform.libc;

ldd = {
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Wouldn't it just be easier to set this to stdenv.hostPlatform.stdenv.cc.libc? All libcs should provide ldd, if I'm not mistaken.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah that sounds like a good idea.

@tathougies
Copy link
Contributor Author

tathougies commented Oct 29, 2018

@dtzWill I'll take a look at the branch. I'm using nixos as a base off of which to build an embedded ARM-based home server appliance, and I've mostly got everything I want working (although it seems like NFS may be out of the question). Now, I'm contributing back the patches I think would make sense in mainline nixpkgs (should I work off your branch instead?). I've had to make substantial changes to nixpkgs, but I now have a musl-based ARM board that boots and gives me a getty. I've switched out systemd with runit to make it work of course, because systemd does not support musl, and I'm not going to fight that battle :)

@matthewbauer
Copy link
Member

@dtzWill what issues are you seeing on your branch? If you could collect together the safe commits I think we can get those merged (some of the systemd stuff might be too much).

@matthewbauer
Copy link
Member

Merged in #49504

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants