about summary refs log tree commit diff
diff options
context:
space:
mode:
-rw-r--r--src/libstore/build.cc2
-rw-r--r--src/libstore/local-store.cc2
2 files changed, 3 insertions, 1 deletions
diff --git a/src/libstore/build.cc b/src/libstore/build.cc
index 9316c069eaa0..f232fe86a967 100644
--- a/src/libstore/build.cc
+++ b/src/libstore/build.cc
@@ -3107,7 +3107,7 @@ void SubstitutionGoal::init()
     if (settings.readOnlyMode)
         throw Error(format("cannot substitute path ‘%1%’ - no write access to the Nix store") % storePath);
 
-    subs = getDefaultSubstituters();
+    subs = settings.useSubstitutes ? getDefaultSubstituters() : std::list<ref<Store>>();
 
     tryNext();
 }
diff --git a/src/libstore/local-store.cc b/src/libstore/local-store.cc
index e1ff94d2ce75..1ffacc5b035e 100644
--- a/src/libstore/local-store.cc
+++ b/src/libstore/local-store.cc
@@ -780,6 +780,7 @@ Path LocalStore::queryPathFromHashPart(const string & hashPart)
 
 PathSet LocalStore::querySubstitutablePaths(const PathSet & paths)
 {
+    if (!settings.useSubstitutes) return PathSet();
     PathSet res;
     for (auto & sub : getDefaultSubstituters()) {
         if (sub->storeDir != storeDir) continue;
@@ -799,6 +800,7 @@ PathSet LocalStore::querySubstitutablePaths(const PathSet & paths)
 void LocalStore::querySubstitutablePathInfos(const PathSet & paths,
     SubstitutablePathInfos & infos)
 {
+    if (!settings.useSubstitutes) return;
     for (auto & sub : getDefaultSubstituters()) {
         if (sub->storeDir != storeDir) continue;
         for (auto & path : paths) {