From 39c353f6fa40a5e0ace9e2c3e69848108944845c Mon Sep 17 00:00:00 2001 From: Valentin Gagarin Date: Tue, 13 Feb 2024 14:52:51 +0100 Subject: [PATCH] reword description of the `cores` setting (#9522) * reword description of the `cores` setting - be precise about the `builder` executable - clearly distinguish between `builder` and job parallelism - clarify the role of `mkDerivation` in the example - remove prose for the default, it's shown programmatically - mention relation to `max-jobs` --- src/libstore/globals.hh | 23 +++++++++++++++-------- 1 file changed, 15 insertions(+), 8 deletions(-) diff --git a/src/libstore/globals.hh b/src/libstore/globals.hh index fa2dc8681..8330d6571 100644 --- a/src/libstore/globals.hh +++ b/src/libstore/globals.hh @@ -180,14 +180,21 @@ public: getDefaultCores(), "cores", R"( - Sets the value of the `NIX_BUILD_CORES` environment variable in the - invocation of builders. Builders can use this variable at their - discretion to control the maximum amount of parallelism. For - instance, in Nixpkgs, if the derivation attribute - `enableParallelBuilding` is set to `true`, the builder passes the - `-jN` flag to GNU Make. It can be overridden using the `--cores` - command line switch and defaults to `1`. The value `0` means that - the builder should use all available CPU cores in the system. + Sets the value of the `NIX_BUILD_CORES` environment variable in the [invocation of the `builder` executable](@docroot@/language/derivations.md#builder-execution) of a derivation. + The `builder` executable can use this variable to control its own maximum amount of parallelism. + + + For instance, in Nixpkgs, if the attribute `enableParallelBuilding` for the `mkDerivation` build helper is set to `true`, it will pass the `-j${NIX_BUILD_CORES}` flag to GNU Make. + + The value `0` means that the `builder` should use all available CPU cores in the system. + + > **Note** + > + > The number of parallel local Nix build jobs is independently controlled with the [`max-jobs`](#conf-max-jobs) setting. )", {"build-cores"}, // Don't document the machine-specific default value