rust.lib: restore required trailing \

Commit c4f5dfad0d was intended as a stylistic cleanup, but the trailing \ it
removed from pkgs/build-support/rust/lib/default.nix was not stylistic: it is a
shell line continuation that joins the cross-only env var block to the cargo
command added by consumers. Without it, `CC_*`, `CXX_*`, and
`CARGO_TARGET_*_LINKER` are silently not passed to cargo when
rustTargetPlatform != rustHostPlatform.

This in turn can break cross compilation of Rust packages.

Fix it by adding back the trailing \

Fixes: #497857

Signed-off-by: Gilberto Bertin <me@jibi.io>
This commit is contained in:
Gilberto Bertin
2026-05-11 12:34:22 +02:00
parent 8cb8ba5cc6
commit 42955023b2
+1 -1
View File
@@ -77,7 +77,7 @@
+ lib.optionalString (rustTargetPlatform != rustHostPlatform) ''
"CC_${stdenv.targetPlatform.rust.cargoEnvVarTarget}=${ccForTarget}" \
"CXX_${stdenv.targetPlatform.rust.cargoEnvVarTarget}=${cxxForTarget}" \
"CARGO_TARGET_${stdenv.targetPlatform.rust.cargoEnvVarTarget}_LINKER=${ccForTarget}"
"CARGO_TARGET_${stdenv.targetPlatform.rust.cargoEnvVarTarget}_LINKER=${ccForTarget}" \
'';
};
}