diff options
Diffstat (limited to 'pkgs/os-specific/linux/minimal-bootstrap/bash/default.nix')
-rw-r--r-- | pkgs/os-specific/linux/minimal-bootstrap/bash/default.nix | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/pkgs/os-specific/linux/minimal-bootstrap/bash/default.nix b/pkgs/os-specific/linux/minimal-bootstrap/bash/default.nix index 35c4da7acf9..86fa3a58687 100644 --- a/pkgs/os-specific/linux/minimal-bootstrap/bash/default.nix +++ b/pkgs/os-specific/linux/minimal-bootstrap/bash/default.nix @@ -54,6 +54,17 @@ bootBash.runCommand "${pname}-${version}" { "-e" (builtins.toFile "bash-builder.sh" '' export CONFIG_SHELL=$SHELL + + # Normalize the NIX_BUILD_CORES variable. The value might be 0, which + # means that we're supposed to try and auto-detect the number of + # available CPU cores at run-time. + NIX_BUILD_CORES="''${NIX_BUILD_CORES:-1}" + if ((NIX_BUILD_CORES <= 0)); then + guess=$(nproc 2>/dev/null || true) + ((NIX_BUILD_CORES = guess <= 0 ? 1 : guess)) + fi + export NIX_BUILD_CORES + bash -eux $buildCommandPath '') ]; |