From acb2acf1f5466f2db93fcab727b294b2eeb35844 Mon Sep 17 00:00:00 2001 From: Eelco Dolstra Date: Tue, 21 Feb 2017 14:53:16 +0100 Subject: VM builds: Use -smp when enableParallelBuilding is set --- pkgs/build-support/vm/default.nix | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'pkgs/build-support/vm') 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). -- cgit 1.4.1