about summary refs log tree commit diff
path: root/src/libstore
diff options
context:
space:
mode:
authorEelco Dolstra <eelco.dolstra@logicblox.com>2014-05-02T10·51+0200
committerEelco Dolstra <eelco.dolstra@logicblox.com>2014-05-02T10·51+0200
commitde4cdd0d47adc70a4db12397a42c18ee50b4e662 (patch)
treee8116fd97457c077e2f15b7086c211d708a93aeb /src/libstore
parentada3e3fa15bc14aebb2bafd1240c15cf1fd99351 (diff)
Set build-max-jobs to the number of available cores by default
More zero configuration.
Diffstat (limited to 'src/libstore')
-rw-r--r--src/libstore/globals.cc5
1 files changed, 5 insertions, 0 deletions
diff --git a/src/libstore/globals.cc b/src/libstore/globals.cc
index c359367bba6d..739199d48ee7 100644
--- a/src/libstore/globals.cc
+++ b/src/libstore/globals.cc
@@ -5,6 +5,7 @@
 
 #include <map>
 #include <algorithm>
+#include <unistd.h>
 
 
 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;