Register flake-registry.json as a GC root again
This commit is contained in:
parent
1c127e6a82
commit
8aa354fdfd
|
@ -127,10 +127,12 @@ static std::shared_ptr<Registry> getGlobalRegistry(ref<Store> store)
|
||||||
static auto reg = [&]() {
|
static auto reg = [&]() {
|
||||||
auto path = settings.flakeRegistry;
|
auto path = settings.flakeRegistry;
|
||||||
|
|
||||||
if (!hasPrefix(path, "/"))
|
if (!hasPrefix(path, "/")) {
|
||||||
// FIXME: register as GC root.
|
auto storePath = downloadFile(store, path, "flake-registry.json", false).storePath;
|
||||||
// FIXME: if download fails, use previous version if available.
|
if (auto store2 = store.dynamic_pointer_cast<LocalFSStore>())
|
||||||
path = store->toRealPath(downloadFile(store, path, "flake-registry.json", false).storePath);
|
store2->addPermRoot(storePath, getCacheDir() + "/nix/flake-registry.json", true);
|
||||||
|
path = store->toRealPath(storePath);
|
||||||
|
}
|
||||||
|
|
||||||
return Registry::read(path, Registry::Global);
|
return Registry::read(path, Registry::Global);
|
||||||
}();
|
}();
|
||||||
|
|
|
@ -269,6 +269,7 @@ nix build -o $TEST_ROOT/result $flake3Dir#sth 2>&1 | grep 'unsupported edition'
|
||||||
# Test whether registry caching works.
|
# Test whether registry caching works.
|
||||||
nix flake list --flake-registry file://$registry | grep -q flake3
|
nix flake list --flake-registry file://$registry | grep -q flake3
|
||||||
mv $registry $registry.tmp
|
mv $registry $registry.tmp
|
||||||
|
nix-store --gc
|
||||||
nix flake list --flake-registry file://$registry --refresh | grep -q flake3
|
nix flake list --flake-registry file://$registry --refresh | grep -q flake3
|
||||||
mv $registry.tmp $registry
|
mv $registry.tmp $registry
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue