diff --git a/pkgs/build-support/rust/build-rust-package/default.nix b/pkgs/build-support/rust/build-rust-package/default.nix index 421b69fb3488..5d8d0ecc6935 100644 --- a/pkgs/build-support/rust/build-rust-package/default.nix +++ b/pkgs/build-support/rust/build-rust-package/default.nix @@ -72,9 +72,11 @@ lib.extendMkDerivation { ... }@args: - let - - cargoDeps' = + lib.optionalAttrs (stdenv.hostPlatform.isDarwin && buildType == "debug") { + RUSTFLAGS = "-C split-debuginfo=packed " + (args.RUSTFLAGS or ""); + } + // { + cargoDeps = if cargoVendorDir != null then null else if cargoDeps != null then @@ -125,12 +127,6 @@ lib.extendMkDerivation { } // depsExtraArgs ); - in - lib.optionalAttrs (stdenv.hostPlatform.isDarwin && buildType == "debug") { - RUSTFLAGS = "-C split-debuginfo=packed " + (args.RUSTFLAGS or ""); - } - // { - cargoDeps = cargoDeps'; inherit buildAndTestSubdir; cargoBuildType = buildType;