File tree Expand file tree Collapse file tree 1 file changed +14
-11
lines changed
pkgs/build-support/rust/build-rust-package Expand file tree Collapse file tree 1 file changed +14
-11
lines changed Original file line number Diff line number Diff line change @@ -89,17 +89,20 @@ lib.extendMkDerivation {
8989 "buildRustPackage: `useFetchCargoVendor` is non‐optional and enabled by default as of 25.05, remove it"
9090 true ;
9191 {
92- env = {
93- PKG_CONFIG_ALLOW_CROSS = if stdenv . buildPlatform != stdenv . hostPlatform then 1 else 0 ;
94- RUST_LOG = logLevel ;
95- RUSTFLAGS =
96- lib . optionalString (
97- stdenv . hostPlatform . isDarwin && buildType == "debug"
98- ) "-C split-debuginfo=packed "
99- # Workaround the existing RUSTFLAGS specified as a list.
100- + interpolateString ( args . RUSTFLAGS or "" ) ;
101- }
102- // args . env or { } ;
92+ env =
93+ let
94+ isDarwinDebug = stdenv . hostPlatform . isDarwin && buildType == "debug" ;
95+ in
96+ {
97+ PKG_CONFIG_ALLOW_CROSS = if stdenv . buildPlatform != stdenv . hostPlatform then 1 else 0 ;
98+ RUST_LOG = logLevel ;
99+ # Prevent shadowing *_RUSTFLAGS environment variables
100+ ${ if args ? RUSTFLAGS || isDarwinDebug then "RUSTFLAGS" else null } =
101+ lib . optionalString isDarwinDebug "-C split-debuginfo=packed "
102+ # Workaround the existing RUSTFLAGS specified as a list.
103+ + interpolateString ( args . RUSTFLAGS or "" ) ;
104+ }
105+ // args . env or { } ;
103106
104107 cargoDeps =
105108 if cargoVendorDir != null then
You can’t perform that action at this time.
0 commit comments