Skip to content
Snippets Groups Projects
Commit de4cdd0d authored by Eelco Dolstra's avatar Eelco Dolstra
Browse files

Set build-max-jobs to the number of available cores by default

More zero configuration.
parent ada3e3fa
No related branches found
No related tags found
No related merge requests found
...@@ -5,6 +5,7 @@ ...@@ -5,6 +5,7 @@
#include <map> #include <map>
#include <algorithm> #include <algorithm>
#include <unistd.h>
namespace nix { namespace nix {
...@@ -29,6 +30,10 @@ Settings::Settings() ...@@ -29,6 +30,10 @@ Settings::Settings()
buildVerbosity = lvlError; buildVerbosity = lvlError;
maxBuildJobs = 1; maxBuildJobs = 1;
buildCores = 1; buildCores = 1;
#ifdef _SC_NPROCESSORS_ONLN
long res = sysconf(_SC_NPROCESSORS_ONLN);
if (res > 0) buildCores = res;
#endif
readOnlyMode = false; readOnlyMode = false;
thisSystem = SYSTEM; thisSystem = SYSTEM;
maxSilentTime = 0; maxSilentTime = 0;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment