aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorregnat <rg@regnat.ovh>2021-12-22 11:31:14 +0100
committerpennae <github@quasiparticle.net>2022-03-03 17:47:50 +0100
commit417aaf4ff7ac1ca501c5a460775fa25d8e078c8a (patch)
tree45ff3c7219ad13a5374db5ee5b3f2ffa8d8095a2 /src
parent2799fe4cdbe77e017544f2fe61ae9baef650dbe6 (diff)
Correctly hijack the `file://` uri scheme with `_NIX_FORCE_HTTP`
Setting the `_NIX_FORCE_HTTP` environment variable is supposed to force `file://` store urls to use the `HttpBinaryCacheStore` implementation rather than the `LocalBinaryCacheStore` one (very useful for testing). However because of a name mismatch, the `LocalBinaryCacheStore` was still registering the `file` scheme when this variable was set, meaning that the actual store implementation picked up on `file://` uris was dependent on the registration order of the stores (itself dependent on the link order of the object files). Fix this by making the `LocalBinaryCacheStore` gracefully not register the `file` uri scheme when the variable is set.
Diffstat (limited to 'src')
-rw-r--r--src/libstore/local-binary-cache-store.cc2
1 files changed, 1 insertions, 1 deletions
diff --git a/src/libstore/local-binary-cache-store.cc b/src/libstore/local-binary-cache-store.cc
index f754770f9..a3c3e4806 100644
--- a/src/libstore/local-binary-cache-store.cc
+++ b/src/libstore/local-binary-cache-store.cc
@@ -107,7 +107,7 @@ bool LocalBinaryCacheStore::fileExists(const std::string & path)
std::set<std::string> LocalBinaryCacheStore::uriSchemes()
{
- if (getEnv("_NIX_FORCE_HTTP_BINARY_CACHE_STORE") == "1")
+ if (getEnv("_NIX_FORCE_HTTP") == "1")
return {};
else
return {"file"};