about summary refs log tree commit diff
path: root/src/libstore/local-binary-cache-store.cc
diff options
context:
space:
mode:
Diffstat (limited to 'src/libstore/local-binary-cache-store.cc')
-rw-r--r--src/libstore/local-binary-cache-store.cc7
1 files changed, 7 insertions, 0 deletions
diff --git a/src/libstore/local-binary-cache-store.cc b/src/libstore/local-binary-cache-store.cc
index e979a94b7aca..b418c9c04148 100644
--- a/src/libstore/local-binary-cache-store.cc
+++ b/src/libstore/local-binary-cache-store.cc
@@ -1,5 +1,6 @@
 #include "binary-cache-store.hh"
 #include "globals.hh"
+#include "nar-info-disk-cache.hh"
 
 namespace nix {
 
@@ -16,6 +17,9 @@ public:
         : BinaryCacheStore(params)
         , binaryCacheDir(binaryCacheDir)
     {
+        /* For testing the NAR info cache. */
+        if (getEnv("_NIX_CACHE_FILE_URLS") == "1")
+            diskCache = getNarInfoDiskCache();
     }
 
     void init() override;
@@ -53,6 +57,9 @@ void LocalBinaryCacheStore::init()
 {
     createDirs(binaryCacheDir + "/nar");
     BinaryCacheStore::init();
+
+    if (diskCache && !diskCache->cacheExists(getUri()))
+        diskCache->createCache(getUri(), wantMassQuery_, priority);
 }
 
 static void atomicWrite(const Path & path, const std::string & s)