1
1
Fork 0
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:
Eelco Dolstra 2025-11-19 16:05:33 +00:00 committed by GitHub
commit 72dbd43882
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
4 changed files with 12 additions and 16 deletions

View file

@ -132,7 +132,7 @@ MixEvalArgs::MixEvalArgs()
fetchers::Attrs extraAttrs; fetchers::Attrs extraAttrs;
if (to.subdir != "") if (to.subdir != "")
extraAttrs["dir"] = 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) { .completer = {[&](AddCompletions & completions, size_t, std::string_view prefix) {
completeFlakeRef(completions, openStore(), prefix); completeFlakeRef(completions, openStore(), prefix);

View file

@ -185,7 +185,6 @@ MixFlakeOptions::MixFlakeOptions()
} }
overrideRegistry( overrideRegistry(
fetchSettings,
fetchers::Input::fromAttrs(fetchSettings, {{"type", "indirect"}, {"id", inputName}}), fetchers::Input::fromAttrs(fetchSettings, {{"type", "indirect"}, {"id", inputName}}),
input3->lockedRef.input, input3->lockedRef.input,
extraAttrs); extraAttrs);

View file

@ -13,8 +13,6 @@ namespace nix::fetchers {
struct Registry struct Registry
{ {
const Settings & settings;
enum RegistryType { enum RegistryType {
Flag = 0, Flag = 0,
User = 1, User = 1,
@ -34,9 +32,8 @@ struct Registry
std::vector<Entry> entries; std::vector<Entry> entries;
Registry(const Settings & settings, RegistryType type) Registry(RegistryType type)
: settings{settings} : type{type}
, type{type}
{ {
} }
@ -59,7 +56,7 @@ Path getUserRegistryPath();
Registries getRegistries(const Settings & settings, Store & store); 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 { enum class UseRegistries : int {
No, No,

View file

@ -14,10 +14,10 @@ std::shared_ptr<Registry> Registry::read(const Settings & settings, const Source
{ {
debug("reading registry '%s'", path); debug("reading registry '%s'", path);
auto registry = std::make_shared<Registry>(settings, type); auto registry = std::make_shared<Registry>(type);
if (!path.pathExists()) if (!path.pathExists())
return std::make_shared<Registry>(settings, type); return std::make_shared<Registry>(type);
try { try {
@ -125,15 +125,15 @@ std::shared_ptr<Registry> getCustomRegistry(const Settings & settings, const Pat
return customRegistry; 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; 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) 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 = [&]() { static auto reg = [&]() {
auto path = settings.flakeRegistry.get(); auto path = settings.flakeRegistry.get();
if (path == "") { if (path == "") {
return std::make_shared<Registry>(settings, Registry::Global); // empty registry return std::make_shared<Registry>(Registry::Global); // empty registry
} }
return Registry::read( 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 getRegistries(const Settings & settings, Store & store)
{ {
Registries registries; Registries registries;
registries.push_back(getFlagRegistry(settings)); registries.push_back(getFlagRegistry());
registries.push_back(getUserRegistry(settings)); registries.push_back(getUserRegistry(settings));
registries.push_back(getSystemRegistry(settings)); registries.push_back(getSystemRegistry(settings));
registries.push_back(getGlobalRegistry(settings, store)); registries.push_back(getGlobalRegistry(settings, store));