Make the URL/path of the global flake registry configurable
This commit is contained in:
parent
c38c726eb5
commit
3c171851a8
|
@ -1972,6 +1972,14 @@ std::ostream & operator << (std::ostream & str, const ExternalValueBase & v) {
|
||||||
|
|
||||||
EvalSettings evalSettings;
|
EvalSettings evalSettings;
|
||||||
|
|
||||||
|
EvalSettings::EvalSettings()
|
||||||
|
{
|
||||||
|
if (flakeRegistry == "")
|
||||||
|
// FIXME: static initialization order fiasco. But this will go
|
||||||
|
// away when we switch to an online registry.
|
||||||
|
flakeRegistry = settings.nixDataDir + "/nix/flake-registry.json";
|
||||||
|
}
|
||||||
|
|
||||||
static GlobalConfig::Register r1(&evalSettings);
|
static GlobalConfig::Register r1(&evalSettings);
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -367,6 +367,11 @@ struct EvalSettings : Config
|
||||||
|
|
||||||
Setting<Strings> allowedUris{this, {}, "allowed-uris",
|
Setting<Strings> allowedUris{this, {}, "allowed-uris",
|
||||||
"Prefixes of URIs that builtin functions such as fetchurl and fetchGit are allowed to fetch."};
|
"Prefixes of URIs that builtin functions such as fetchurl and fetchGit are allowed to fetch."};
|
||||||
|
|
||||||
|
Setting<std::string> flakeRegistry{this, "", "flake-registry",
|
||||||
|
"Path or URI of the global flake registry."};
|
||||||
|
|
||||||
|
EvalSettings();
|
||||||
};
|
};
|
||||||
|
|
||||||
extern EvalSettings evalSettings;
|
extern EvalSettings evalSettings;
|
||||||
|
|
|
@ -126,8 +126,7 @@ void writeLockFile(const LockFile & lockFile, const Path & path)
|
||||||
|
|
||||||
std::shared_ptr<FlakeRegistry> getGlobalRegistry()
|
std::shared_ptr<FlakeRegistry> getGlobalRegistry()
|
||||||
{
|
{
|
||||||
Path registryFile = settings.nixDataDir + "/nix/flake-registry.json";
|
return readRegistry(evalSettings.flakeRegistry);
|
||||||
return readRegistry(registryFile);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
Path getUserRegistryPath()
|
Path getUserRegistryPath()
|
||||||
|
|
Loading…
Reference in a new issue