about summary refs log tree commit diff
path: root/src/libstore
diff options
context:
space:
mode:
authorEelco Dolstra <edolstra@gmail.com>2019-04-01T19·09+0200
committerEelco Dolstra <edolstra@gmail.com>2019-04-01T19·09+0200
commit41ba5135e0a2d9940c4e8cbedff44eb1a47af782 (patch)
treefbf7131ee1f3dd4463358500414df5de829c84db /src/libstore
parent2bc6304793e14e44d6d24c1fb35666352c7106f2 (diff)
primeCache(): Barf if builds are needed but not allowed
Fixes #2753.
Diffstat (limited to 'src/libstore')
-rw-r--r--src/libstore/build.cc6
1 files changed, 6 insertions, 0 deletions
diff --git a/src/libstore/build.cc b/src/libstore/build.cc
index 6b88b1307303..53a0c743b035 100644
--- a/src/libstore/build.cc
+++ b/src/libstore/build.cc
@@ -12,6 +12,7 @@
 #include "json.hh"
 #include "nar-info.hh"
 #include "parsed-derivations.hh"
+#include "machines.hh"
 
 #include <algorithm>
 #include <iostream>
@@ -4411,6 +4412,11 @@ static void primeCache(Store & store, const PathSet & paths)
     PathSet willBuild, willSubstitute, unknown;
     unsigned long long downloadSize, narSize;
     store.queryMissing(paths, willBuild, willSubstitute, unknown, downloadSize, narSize);
+
+    if (!willBuild.empty() && 0 == settings.maxBuildJobs && getMachines().empty())
+        throw Error(
+            "%d derivations need to be built, but neither local builds ('--max-jobs') "
+            "nor remote builds ('--builders') are enabled", willBuild.size());
 }