summary refs log tree commit diff
path: root/pkgs/os-specific/linux/minimal-bootstrap/bash/2.nix
diff options
context:
space:
mode:
Diffstat (limited to 'pkgs/os-specific/linux/minimal-bootstrap/bash/2.nix')
-rw-r--r--pkgs/os-specific/linux/minimal-bootstrap/bash/2.nix11
1 files changed, 11 insertions, 0 deletions
diff --git a/pkgs/os-specific/linux/minimal-bootstrap/bash/2.nix b/pkgs/os-specific/linux/minimal-bootstrap/bash/2.nix
index 41e3547a786..5eea877803a 100644
--- a/pkgs/os-specific/linux/minimal-bootstrap/bash/2.nix
+++ b/pkgs/os-specific/linux/minimal-bootstrap/bash/2.nix
@@ -84,6 +84,17 @@ kaem.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. We don't have nproc to detect the
+          # number of available CPU cores so default to 1 if not set.
+          NIX_BUILD_CORES="''${NIX_BUILD_CORES:-1}"
+          if [ $NIX_BUILD_CORES -le 0 ]; then
+            NIX_BUILD_CORES=1
+          fi
+          export NIX_BUILD_CORES
+
           bash -eux $buildCommandPath
         '')
       ];