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

rustup: add helper to bring dev pkgs in for compilition #75453

wants to merge 1 commit into from


Copy link

@oxalica oxalica commented Dec 10, 2019

Motivation for this change

When compiling -sys crates, some dependent libraries will be found using pkg-config and get linked. Since our pkg-config use setup-hook to locate pkgs, that means we need to compile always in nix-shell -p pkg-config <other-deps>. Installing these packages globally does not work.

This PR introduces a helper function providing a customized rustup wrapper to make some often-used developing packages available for compiling, without the requirement of nix-shell every time.

  • nix-env -iE 'with import <nixpkgs> {}; rustup-with-dev { devPkgs = [ ]; }'
  • cargo build some_crate_using_openssl_sys # Feel free
More concerns:
  • Should we name it to rustup_configurable just like vim_configurable? (With maybe future extension?)
  • More documentation?
Things done
  • Tested using sandboxing (nix.useSandbox on NixOS, or option sandbox in nix.conf on non-NixOS linux)
  • 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 nix-review --run "nix-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)
  • Ensured that relevant documentation is up to date
  • Fits
Notify maintainers

cc @Mic92

Copy link

@Mic92 Mic92 commented Dec 10, 2019

This wrapper seems rather opinionated. It uses rustup instead of rustc. It only takes pkg-config's setup-hook into account but ignores all environment variables set are set by other packages i.e CC/CXX/NIX_CFLAGS_COMPILE/NIX_LDFLAGS/CMAKE_LIBRARY_PATH. Also one would need to either pack all non-rust dependencies into this wrapper or use a nix-shell again to get additional dependencies. This does not quite fit the design of nix and nixpkgs. I don't think we should have it in nixpkgs.

@oxalica oxalica closed this Dec 13, 2019
@oxalica oxalica deleted the oxalica:rustup-with-dev branch Dec 23, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
None yet
Linked issues

Successfully merging this pull request may close these issues.

None yet

2 participants
You can’t perform that action at this time.