buildRustCrate: set NUM_JOBS to NIX_BUILD_CORES

Bofore this change, NUM_JOBS was set to 1. Some crates for building
C/C++ code (e.g. the cc and cmake crates), rely on this variable to
set the number of jobs. As a consequence, we were compiling embedded
libraries serially. Change this to NIX_BUILD_CORES to permit parallel
builds.

Prior discussion:

https://github.com/NixOS/nixpkgs/pull/50452#issuecomment-439407547
This commit is contained in:
Daniël de Kok 2020-12-03 12:44:12 +01:00
parent 3a2e9d2ac7
commit e87d457564

View File

@ -144,7 +144,7 @@ in ''
export CARGO_PKG_VERSION_PATCH=${lib.elemAt version 2}
export CARGO_PKG_VERSION_PRE="${versionPre}"
export CARGO_PKG_HOMEPAGE="${crateHomepage}"
export NUM_JOBS=1
export NUM_JOBS=$NIX_BUILD_CORES
export RUSTC="rustc"
export RUSTDOC="rustdoc"