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")

authored by

Alyssa Ross and committed by
GitHub
7262026f b8d473b6

+3 -3
+3 -3
pkgs/build-support/rust/hooks/default.nix
··· 67 67 cargoConfig = '' 68 68 [target."${rust.toRustTarget stdenv.buildPlatform}"] 69 69 "linker" = "${rust.envVars.ccForBuild}" 70 - ${lib.optionalString (stdenv.hostPlatform.config != stdenv.targetPlatform.config) '' 71 - [target."${rust.toRustTarget stdenv.targetPlatform}"] 72 - "linker" = "${rust.envVars.ccForTarget}" 70 + ${lib.optionalString (stdenv.buildPlatform.config != stdenv.hostPlatform.config) '' 71 + [target."${rust.toRustTarget stdenv.hostPlatform}"] 72 + "linker" = "${rust.envVars.ccForHost}" 73 73 ''} 74 74 "rustflags" = [ "-C", "target-feature=${if stdenv.hostPlatform.isStatic then "+" else "-"}crt-static" ] 75 75 '';