mirror of
https://github.com/NixOS/nix.git
synced 2025-11-22 18:29:36 +01:00
Merge pull request #14594 from NixOS/registry-drop-settings
Registry: Drop settings field
This commit is contained in:
commit
72dbd43882
4 changed files with 12 additions and 16 deletions
|
|
@ -132,7 +132,7 @@ MixEvalArgs::MixEvalArgs()
|
|||
fetchers::Attrs extraAttrs;
|
||||
if (to.subdir != "")
|
||||
extraAttrs["dir"] = to.subdir;
|
||||
fetchers::overrideRegistry(fetchSettings, from.input, to.input, extraAttrs);
|
||||
fetchers::overrideRegistry(from.input, to.input, extraAttrs);
|
||||
}},
|
||||
.completer = {[&](AddCompletions & completions, size_t, std::string_view prefix) {
|
||||
completeFlakeRef(completions, openStore(), prefix);
|
||||
|
|
|
|||
|
|
@ -185,7 +185,6 @@ MixFlakeOptions::MixFlakeOptions()
|
|||
}
|
||||
|
||||
overrideRegistry(
|
||||
fetchSettings,
|
||||
fetchers::Input::fromAttrs(fetchSettings, {{"type", "indirect"}, {"id", inputName}}),
|
||||
input3->lockedRef.input,
|
||||
extraAttrs);
|
||||
|
|
|
|||
|
|
@ -13,8 +13,6 @@ namespace nix::fetchers {
|
|||
|
||||
struct Registry
|
||||
{
|
||||
const Settings & settings;
|
||||
|
||||
enum RegistryType {
|
||||
Flag = 0,
|
||||
User = 1,
|
||||
|
|
@ -34,9 +32,8 @@ struct Registry
|
|||
|
||||
std::vector<Entry> entries;
|
||||
|
||||
Registry(const Settings & settings, RegistryType type)
|
||||
: settings{settings}
|
||||
, type{type}
|
||||
Registry(RegistryType type)
|
||||
: type{type}
|
||||
{
|
||||
}
|
||||
|
||||
|
|
@ -59,7 +56,7 @@ Path getUserRegistryPath();
|
|||
|
||||
Registries getRegistries(const Settings & settings, Store & store);
|
||||
|
||||
void overrideRegistry(const Settings & settings, const Input & from, const Input & to, const Attrs & extraAttrs);
|
||||
void overrideRegistry(const Input & from, const Input & to, const Attrs & extraAttrs);
|
||||
|
||||
enum class UseRegistries : int {
|
||||
No,
|
||||
|
|
|
|||
|
|
@ -14,10 +14,10 @@ std::shared_ptr<Registry> Registry::read(const Settings & settings, const Source
|
|||
{
|
||||
debug("reading registry '%s'", path);
|
||||
|
||||
auto registry = std::make_shared<Registry>(settings, type);
|
||||
auto registry = std::make_shared<Registry>(type);
|
||||
|
||||
if (!path.pathExists())
|
||||
return std::make_shared<Registry>(settings, type);
|
||||
return std::make_shared<Registry>(type);
|
||||
|
||||
try {
|
||||
|
||||
|
|
@ -125,15 +125,15 @@ std::shared_ptr<Registry> getCustomRegistry(const Settings & settings, const Pat
|
|||
return customRegistry;
|
||||
}
|
||||
|
||||
std::shared_ptr<Registry> getFlagRegistry(const Settings & settings)
|
||||
std::shared_ptr<Registry> getFlagRegistry()
|
||||
{
|
||||
static auto flagRegistry = std::make_shared<Registry>(settings, Registry::Flag);
|
||||
static auto flagRegistry = std::make_shared<Registry>(Registry::Flag);
|
||||
return flagRegistry;
|
||||
}
|
||||
|
||||
void overrideRegistry(const Settings & settings, const Input & from, const Input & to, const Attrs & extraAttrs)
|
||||
void overrideRegistry(const Input & from, const Input & to, const Attrs & extraAttrs)
|
||||
{
|
||||
getFlagRegistry(settings)->add(from, to, extraAttrs);
|
||||
getFlagRegistry()->add(from, to, extraAttrs);
|
||||
}
|
||||
|
||||
static std::shared_ptr<Registry> getGlobalRegistry(const Settings & settings, Store & store)
|
||||
|
|
@ -141,7 +141,7 @@ static std::shared_ptr<Registry> getGlobalRegistry(const Settings & settings, St
|
|||
static auto reg = [&]() {
|
||||
auto path = settings.flakeRegistry.get();
|
||||
if (path == "") {
|
||||
return std::make_shared<Registry>(settings, Registry::Global); // empty registry
|
||||
return std::make_shared<Registry>(Registry::Global); // empty registry
|
||||
}
|
||||
|
||||
return Registry::read(
|
||||
|
|
@ -165,7 +165,7 @@ static std::shared_ptr<Registry> getGlobalRegistry(const Settings & settings, St
|
|||
Registries getRegistries(const Settings & settings, Store & store)
|
||||
{
|
||||
Registries registries;
|
||||
registries.push_back(getFlagRegistry(settings));
|
||||
registries.push_back(getFlagRegistry());
|
||||
registries.push_back(getUserRegistry(settings));
|
||||
registries.push_back(getSystemRegistry(settings));
|
||||
registries.push_back(getGlobalRegistry(settings, store));
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue