1
0
Fork 0
mirror of https://github.com/NixOS/nix synced 2025-06-27 00:11:17 +02:00

Fetch the flake registry from the NixOS/flake-registry repo

This commit is contained in:
Eelco Dolstra 2019-05-22 22:56:46 +02:00
parent 55a0451e51
commit 66f1d7ee95
7 changed files with 19 additions and 41 deletions

View file

@ -131,9 +131,19 @@ void writeLockFile(const LockFile & lockFile, const Path & path)
writeFile(path, json.dump(4) + "\n"); // '4' = indentation in json file
}
std::shared_ptr<FlakeRegistry> getGlobalRegistry()
std::shared_ptr<FlakeRegistry> EvalState::getGlobalFlakeRegistry()
{
return readRegistry(evalSettings.flakeRegistry);
std::call_once(_globalFlakeRegistryInit, [&]() {
auto path = evalSettings.flakeRegistry;
if (!hasPrefix(path, "/"))
path = getDownloader()->downloadCached(store,
evalSettings.flakeRegistry, false, "registry").path;
_globalFlakeRegistry = readRegistry(path);
});
return _globalFlakeRegistry;
}
Path getUserRegistryPath()
@ -162,7 +172,7 @@ const Registries EvalState::getFlakeRegistries()
Registries registries;
registries.push_back(getFlagRegistry(registryOverrides));
registries.push_back(getUserRegistry());
registries.push_back(getGlobalRegistry());
registries.push_back(getGlobalFlakeRegistry());
return registries;
}