diff options
-rw-r--r-- | pkgs/build-support/rust/lib/default.nix | 32 | ||||
-rw-r--r-- | pkgs/development/compilers/rust/1_75.nix | 6 | ||||
-rw-r--r-- | pkgs/development/compilers/rust/default.nix | 10 |
3 files changed, 23 insertions, 25 deletions
diff --git a/pkgs/build-support/rust/lib/default.nix b/pkgs/build-support/rust/lib/default.nix index e70b8229d3560..4958a42fcdd96 100644 --- a/pkgs/build-support/rust/lib/default.nix +++ b/pkgs/build-support/rust/lib/default.nix @@ -1,7 +1,7 @@ { lib , stdenv -, buildPackages -, targetPackages +, pkgsBuildHost +, pkgsTargetTarget }: rec { @@ -16,26 +16,26 @@ rec { # As a workaround for https://github.com/rust-lang/rust/issues/89626 use lld on pkgsStatic aarch64 shouldUseLLD = platform: platform.isAarch64 && platform.isStatic && !stdenv.isDarwin; - ccForBuild = "${buildPackages.stdenv.cc}/bin/${buildPackages.stdenv.cc.targetPrefix}cc"; - cxxForBuild = "${buildPackages.stdenv.cc}/bin/${buildPackages.stdenv.cc.targetPrefix}c++"; + ccForBuild = "${pkgsBuildHost.stdenv.cc}/bin/${pkgsBuildHost.stdenv.cc.targetPrefix}cc"; + cxxForBuild = "${pkgsBuildHost.stdenv.cc}/bin/${pkgsBuildHost.stdenv.cc.targetPrefix}c++"; linkerForBuild = ccForBuild; ccForHost = "${stdenv.cc}/bin/${stdenv.cc.targetPrefix}cc"; cxxForHost = "${stdenv.cc}/bin/${stdenv.cc.targetPrefix}c++"; linkerForHost = if shouldUseLLD stdenv.targetPlatform && !stdenv.cc.bintools.isLLVM - then "${buildPackages.lld}/bin/ld.lld" + then "${pkgsBuildHost.lld}/bin/ld.lld" else ccForHost; - # Unfortunately we must use the dangerous `targetPackages` here + # Unfortunately we must use the dangerous `pkgsTargetTarget` here # because hooks are artificially phase-shifted one slot earlier # (they go in nativeBuildInputs, so the hostPlatform looks like # a targetPlatform to them). - ccForTarget = "${targetPackages.stdenv.cc}/bin/${targetPackages.stdenv.cc.targetPrefix}cc"; - cxxForTarget = "${targetPackages.stdenv.cc}/bin/${targetPackages.stdenv.cc.targetPrefix}c++"; - linkerForTarget = if shouldUseLLD targetPackages.stdenv.targetPlatform - && !targetPackages.stdenv.cc.bintools.isLLVM # whether stdenv's linker is lld already - then "${buildPackages.lld}/bin/ld.lld" + ccForTarget = "${pkgsTargetTarget.stdenv.cc}/bin/${pkgsTargetTarget.stdenv.cc.targetPrefix}cc"; + cxxForTarget = "${pkgsTargetTarget.stdenv.cc}/bin/${pkgsTargetTarget.stdenv.cc.targetPrefix}c++"; + linkerForTarget = if shouldUseLLD pkgsTargetTarget.stdenv.targetPlatform + && !pkgsTargetTarget.stdenv.cc.bintools.isLLVM # whether stdenv's linker is lld already + then "${pkgsBuildHost.lld}/bin/ld.lld" else ccForTarget; rustBuildPlatform = stdenv.buildPlatform.rust.rustcTarget; @@ -56,9 +56,9 @@ rec { setEnv = '' env \ '' - # Due to a bug in how splicing and targetPackages works, in - # situations where targetPackages is irrelevant - # targetPackages.stdenv.cc is often simply wrong. We must omit + # Due to a bug in how splicing and pkgsTargetTarget works, in + # situations where pkgsTargetTarget is irrelevant + # pkgsTargetTarget.stdenv.cc is often simply wrong. We must omit # the following lines when rustTargetPlatform collides with # rustHostPlatform. + lib.optionalString (rustTargetPlatform != rustHostPlatform) '' @@ -74,8 +74,8 @@ rec { "CXX_${stdenv.buildPlatform.rust.cargoEnvVarTarget}=${cxxForBuild}" \ "CARGO_TARGET_${stdenv.buildPlatform.rust.cargoEnvVarTarget}_LINKER=${linkerForBuild}" \ "CARGO_BUILD_TARGET=${rustBuildPlatform}" \ - "HOST_CC=${buildPackages.stdenv.cc}/bin/cc" \ - "HOST_CXX=${buildPackages.stdenv.cc}/bin/c++" \ + "HOST_CC=${pkgsBuildHost.stdenv.cc}/bin/cc" \ + "HOST_CXX=${pkgsBuildHost.stdenv.cc}/bin/c++" \ ''; }; } // lib.mapAttrs (old: new: platform: diff --git a/pkgs/development/compilers/rust/1_75.nix b/pkgs/development/compilers/rust/1_75.nix index 829b26cac3674..d41a263c8a296 100644 --- a/pkgs/development/compilers/rust/1_75.nix +++ b/pkgs/development/compilers/rust/1_75.nix @@ -10,11 +10,9 @@ # 3. Firefox and Thunderbird should still build on x86_64-linux. { stdenv, lib -, buildPackages -, targetPackages , newScope, callPackage , CoreFoundation, Security, SystemConfiguration -, pkgsBuildTarget, pkgsBuildBuild, pkgsBuildHost +, pkgsBuildTarget, pkgsBuildBuild, pkgsBuildHost, pkgsTargetTarget , makeRustPlatform , wrapRustcWith , llvmPackages_17, llvm_17 @@ -58,4 +56,4 @@ import ./default.nix { rustcPatches = [ ]; } -(builtins.removeAttrs args [ "pkgsBuildTarget" "pkgsBuildHost" "llvmPackages_17" "llvm_17"]) +(builtins.removeAttrs args [ "pkgsBuildTarget" "llvmPackages_17" "llvm_17"]) diff --git a/pkgs/development/compilers/rust/default.nix b/pkgs/development/compilers/rust/default.nix index c08ffa848ef5e..f00c469cd19c2 100644 --- a/pkgs/development/compilers/rust/default.nix +++ b/pkgs/development/compilers/rust/default.nix @@ -12,18 +12,18 @@ , llvmPackages # Exposed through rustc for LTO in Firefox }: { stdenv, lib -, buildPackages -, targetPackages , newScope, callPackage , CoreFoundation, Security, SystemConfiguration , pkgsBuildBuild +, pkgsBuildHost +, pkgsTargetTarget , makeRustPlatform , wrapRustcWith }: let # Use `import` to make sure no packages sneak in here. - lib' = import ../../../build-support/rust/lib { inherit lib stdenv buildPackages targetPackages; }; + lib' = import ../../../build-support/rust/lib { inherit lib stdenv pkgsBuildHost pkgsTargetTarget; }; # Allow faster cross compiler generation by reusing Build artifacts fastCross = (stdenv.buildPlatform == stdenv.hostPlatform) && (stdenv.hostPlatform != stdenv.targetPlatform); in @@ -58,11 +58,11 @@ in else self.buildRustPackages.overrideScope (_: _: lib.optionalAttrs (stdenv.buildPlatform == stdenv.hostPlatform) - (selectRustPackage buildPackages).packages.prebuilt); + (selectRustPackage pkgsBuildHost).packages.prebuilt); bootRustPlatform = makeRustPlatform bootstrapRustPackages; in { # Packages suitable for build-time, e.g. `build.rs`-type stuff. - buildRustPackages = (selectRustPackage buildPackages).packages.stable // { __attrsFailEvaluation = true; }; + buildRustPackages = (selectRustPackage pkgsBuildHost).packages.stable // { __attrsFailEvaluation = true; }; # Analogous to stdenv rustPlatform = makeRustPlatform self.buildRustPackages; rustc-unwrapped = self.callPackage ./rustc.nix ({ |