From 112d13c5c7c83593972e786cfa9f6fcef06bdfd9 Mon Sep 17 00:00:00 2001 From: Alyssa Ross Date: Tue, 13 May 2025 19:00:42 +0200 Subject: [PATCH] cargoSetupHook: fix setting crt-static As is retrospectively obvious from the fact that it was looking at pkgsTargetTarget, this should have been in the section for the target, not the host. This fixes e.g. pkgsStatic.xq for 64-bit RISC-V. (For platforms other than 64-bit RISC-V this being wrong was masked by the musl Rust targets being static by default.) --- pkgs/build-support/rust/hooks/default.nix | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/pkgs/build-support/rust/hooks/default.nix b/pkgs/build-support/rust/hooks/default.nix index 21278ec382d1..d66804b07ab7 100644 --- a/pkgs/build-support/rust/hooks/default.nix +++ b/pkgs/build-support/rust/hooks/default.nix @@ -109,13 +109,13 @@ lib.optionalString (stdenv.hostPlatform.config != stdenv.targetPlatform.config) '' [target."${stdenv.targetPlatform.rust.rustcTarget}"] "linker" = "${pkgsTargetTarget.stdenv.cc}/bin/${pkgsTargetTarget.stdenv.cc.targetPrefix}cc" + "rustflags" = [ "-C", "target-feature=${ + if pkgsTargetTarget.stdenv.targetPlatform.isStatic then "+" else "-" + }crt-static" ] '' + '' [target."${stdenv.hostPlatform.rust.rustcTarget}"] "linker" = "${stdenv.cc}/bin/${stdenv.cc.targetPrefix}cc" - "rustflags" = [ "-C", "target-feature=${ - if pkgsTargetTarget.stdenv.targetPlatform.isStatic then "+" else "-" - }crt-static" ] ''; }; passthru.tests =