mirror of
https://github.com/NixOS/nixpkgs.git
synced 2025-06-11 12:15:34 +03:00
rustc: add a compiler wrapper
We keep running into situations where we can't get the right combination of rustc flags through build systems into rustc. RUSTFLAGS is the only variable supported across build systems, but if RUSTFLAGS is set, Cargo will ignore all other ways of specifying rustc flags, including the target-specific ones, which we need to make dynamic musl builds work. (This is why pkgsCross.musl64.crosvm is currently broken — it works if you unset separateDebugInfo, which causes RUSTFLAGS not to be set.) So, we need to do the same thing we do for C and C++ compilers, and add a compiler wrapper so we can inject the flags we need, regardless of the build system. Currently the wrapper only supports a single mechanism for injecting flags — the NIX_RUSTFLAGS environment variable. As time goes on, we'll probably want to add additional features, like target-specific environment variables.
This commit is contained in:
parent
c6f3c0403f
commit
8b51cdd3be
9 changed files with 61 additions and 14 deletions
|
@ -963,7 +963,7 @@ repository:
|
|||
lib.updateManyAttrsByPath [{
|
||||
path = [ "packages" "stable" ];
|
||||
update = old: old.overrideScope(final: prev: {
|
||||
rustc = prev.rustc.overrideAttrs (_: {
|
||||
rustc-unwrapped = prev.rustc-unwrapped.overrideAttrs (_: {
|
||||
src = lib.cleanSource /git/scratch/rust;
|
||||
# do *not* put passthru.isReleaseTarball=true here
|
||||
});
|
||||
|
@ -1003,4 +1003,3 @@ nix-build $NIXPKGS -A package-broken-by-rust-changes
|
|||
The `git submodule update --init` and `cargo vendor` commands above
|
||||
require network access, so they can't be performed from within the
|
||||
`rustc` derivation, unfortunately.
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue