summary refs log tree commit diff
path: root/pkgs/build-support/rust
diff options
context:
space:
mode:
authorAlyssa Ross <hi@alyssa.is>2023-10-11 21:36:56 +0000
committerGitHub <noreply@github.com>2023-10-11 23:36:56 +0200
commit7262026f0f4e4a5f3382e91b564fb27c1ec9dd9e (patch)
treecbdc34a82bca64a73ee978253fd4a14508f4832e /pkgs/build-support/rust
parentb8d473b6d20c91a3f38e3a0ae7492635fc6ed898 (diff)
downloadnixpkgs-7262026f0f4e4a5f3382e91b564fb27c1ec9dd9e.tar
nixpkgs-7262026f0f4e4a5f3382e91b564fb27c1ec9dd9e.tar.gz
nixpkgs-7262026f0f4e4a5f3382e91b564fb27c1ec9dd9e.tar.bz2
nixpkgs-7262026f0f4e4a5f3382e91b564fb27c1ec9dd9e.tar.lz
nixpkgs-7262026f0f4e4a5f3382e91b564fb27c1ec9dd9e.tar.xz
nixpkgs-7262026f0f4e4a5f3382e91b564fb27c1ec9dd9e.tar.zst
nixpkgs-7262026f0f4e4a5f3382e91b564fb27c1ec9dd9e.zip
rustPlatform.cargoSetupHook: fix platform check (#260068)
Cargo will never need to link for the target platform — that'd be for
the package being built to do at runtime.  Cargo should know about the
build and host linkers.

This fixes e.g. pkgsCross.musl64.fd from x86_64-linux.

Fixes: 67a4f828b46c ("rust: hooks: fix cross compilation")
Diffstat (limited to 'pkgs/build-support/rust')
-rw-r--r--pkgs/build-support/rust/hooks/default.nix6
1 files changed, 3 insertions, 3 deletions
diff --git a/pkgs/build-support/rust/hooks/default.nix b/pkgs/build-support/rust/hooks/default.nix
index c73ec30082d..205d085d350 100644
--- a/pkgs/build-support/rust/hooks/default.nix
+++ b/pkgs/build-support/rust/hooks/default.nix
@@ -67,9 +67,9 @@
         cargoConfig = ''
           [target."${rust.toRustTarget stdenv.buildPlatform}"]
           "linker" = "${rust.envVars.ccForBuild}"
-          ${lib.optionalString (stdenv.hostPlatform.config != stdenv.targetPlatform.config) ''
-            [target."${rust.toRustTarget stdenv.targetPlatform}"]
-            "linker" = "${rust.envVars.ccForTarget}"
+          ${lib.optionalString (stdenv.buildPlatform.config != stdenv.hostPlatform.config) ''
+            [target."${rust.toRustTarget stdenv.hostPlatform}"]
+            "linker" = "${rust.envVars.ccForHost}"
           ''}
           "rustflags" = [ "-C", "target-feature=${if stdenv.hostPlatform.isStatic then "+" else "-"}crt-static" ]
         '';