summary refs log tree commit diff
path: root/pkgs/build-support/vm
diff options
context:
space:
mode:
authorEelco Dolstra <edolstra@gmail.com>2017-02-21 14:53:16 +0100
committerEelco Dolstra <edolstra@gmail.com>2017-02-21 15:08:54 +0100
commitacb2acf1f5466f2db93fcab727b294b2eeb35844 (patch)
tree285dc3e312c3fb0394636e06f677a087b7642566 /pkgs/build-support/vm
parent012b5a5c45d2e5b0e690936cd71c8be727047914 (diff)
downloadnixpkgs-acb2acf1f5466f2db93fcab727b294b2eeb35844.tar
nixpkgs-acb2acf1f5466f2db93fcab727b294b2eeb35844.tar.gz
nixpkgs-acb2acf1f5466f2db93fcab727b294b2eeb35844.tar.bz2
nixpkgs-acb2acf1f5466f2db93fcab727b294b2eeb35844.tar.lz
nixpkgs-acb2acf1f5466f2db93fcab727b294b2eeb35844.tar.xz
nixpkgs-acb2acf1f5466f2db93fcab727b294b2eeb35844.tar.zst
nixpkgs-acb2acf1f5466f2db93fcab727b294b2eeb35844.zip
VM builds: Use -smp when enableParallelBuilding is set
Diffstat (limited to 'pkgs/build-support/vm')
-rw-r--r--pkgs/build-support/vm/default.nix8
1 files changed, 8 insertions, 0 deletions
diff --git a/pkgs/build-support/vm/default.nix b/pkgs/build-support/vm/default.nix
index 5bac650215b..203310f624e 100644
--- a/pkgs/build-support/vm/default.nix
+++ b/pkgs/build-support/vm/default.nix
@@ -242,6 +242,14 @@ rec {
 
     eval "$preVM"
 
+    if [ "$enableParallelBuilding" = 1 ]; then
+      if [ ''${NIX_BUILD_CORES:-0} = 0 ]; then
+        QEMU_OPTS+=" -smp cpus=$(nproc)"
+      else
+        QEMU_OPTS+=" -smp cpus=$NIX_BUILD_CORES"
+      fi
+    fi
+
     # Write the command to start the VM to a file so that the user can
     # debug inside the VM if the build fails (when Nix is called with
     # the -K option to preserve the temporary build directory).