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
commite87d4575643ee19c16242132167cf6dfa985dcce
authorDaniël de Kok <me@danieldk.eu>
dateThu 3 Dec 2020, 12:44 (6 years ago)
parent3a2e9d2
pkgs/build-support/rust/build-rust-crate/configure-crate.nix+1−1
@@ -144,7 +144,7 @@ in ''
144144 export CARGO_PKG_VERSION_PATCH=${lib.elemAt version 2}
145145 export CARGO_PKG_VERSION_PRE="${versionPre}"
146146 export CARGO_PKG_HOMEPAGE="${crateHomepage}"
147− export NUM_JOBS=1
147+ export NUM_JOBS=$NIX_BUILD_CORES
148148 export RUSTC="rustc"
149149 export RUSTDOC="rustdoc"
150150