From de4cdd0d47adc70a4db12397a42c18ee50b4e662 Mon Sep 17 00:00:00 2001 From: Eelco Dolstra Date: Fri, 2 May 2014 12:51:43 +0200 Subject: Set build-max-jobs to the number of available cores by default More zero configuration. --- src/libstore/globals.cc | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'src') diff --git a/src/libstore/globals.cc b/src/libstore/globals.cc index c359367bb..739199d48 100644 --- a/src/libstore/globals.cc +++ b/src/libstore/globals.cc @@ -5,6 +5,7 @@ #include #include +#include namespace nix { @@ -29,6 +30,10 @@ Settings::Settings() buildVerbosity = lvlError; maxBuildJobs = 1; buildCores = 1; +#ifdef _SC_NPROCESSORS_ONLN + long res = sysconf(_SC_NPROCESSORS_ONLN); + if (res > 0) buildCores = res; +#endif readOnlyMode = false; thisSystem = SYSTEM; maxSilentTime = 0; -- cgit v1.2.3