mirror of
https://github.com/NixOS/nix.git
synced 2025-11-19 08:49:35 +01:00
build-cores: detect cores automatically if set to 0
This changes makes nix detect a machines available cores automatically whenever build-cores is set to 0. So far, nix simply passed NIX_BUILD_CORES=0 whenever build-cores is set to 0. (only when build-cores is unset it was detecting cores automatically) The behavior of passing NIX_BUILD_CORES=0 leads to a performance penalty when sourcing nixpkgs' generic builder's `setup.sh`, as setup.sh has to execute `nproc`. This significantly slows down sourcing of setup.sh
This commit is contained in:
parent
df2d5f276a
commit
fb5e22e318
8 changed files with 58 additions and 10 deletions
|
|
@ -542,7 +542,7 @@ static void main_nix_build(int argc, char * * argv)
|
|||
|
||||
env["NIX_BUILD_TOP"] = env["TMPDIR"] = env["TEMPDIR"] = env["TMP"] = env["TEMP"] = tmpDir.path().string();
|
||||
env["NIX_STORE"] = store->storeDir;
|
||||
env["NIX_BUILD_CORES"] = std::to_string(settings.buildCores);
|
||||
env["NIX_BUILD_CORES"] = fmt("%d", settings.buildCores ? settings.buildCores : settings.getDefaultCores());
|
||||
|
||||
auto parsedDrv = StructuredAttrs::tryParse(drv.env);
|
||||
DerivationOptions drvOptions;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue