buildRustCrate: prevent pulling in two rustc variants (#526469)

This commit is contained in:
Ilan Joselevich
2026-06-16 16:04:29 +00:00
committed by GitHub
2 changed files with 12 additions and 5 deletions
@@ -155,8 +155,6 @@ crate_:
lib.makeOverridable
(
# The rust compiler to use.
#
# Default: pkgs.rustc
{
rust ? rustc,
# The cargo package to use for getting some metadata.
+12 -3
View File
@@ -4270,11 +4270,20 @@ with pkgs;
);
in
callPackage ../build-support/rust/build-rust-crate (
{ }
// lib.optionalAttrs (stdenv.hostPlatform.libc == null) {
lib.optionalAttrs (stdenv.hostPlatform.libc == null) {
stdenv = stdenvNoCC; # Some build targets without libc will fail to evaluate with a normal stdenv.
}
// lib.optionalAttrs targetAlreadyIncluded { inherit (pkgsBuildBuild) rustc cargo; } # Optimization.
// (
if targetAlreadyIncluded then
# Optimization
{
inherit (pkgsBuildBuild) rustc cargo;
}
else
{
inherit (pkgsBuildHost) rustc cargo;
}
)
);
buildRustCrateHelpers = callPackage ../build-support/rust/build-rust-crate/helpers.nix { };