From bed05706295d12e0c1c7c1238f9f6f455f630443 Mon Sep 17 00:00:00 2001 From: Eelco Dolstra Date: Wed, 19 Nov 2025 11:50:01 +0100 Subject: [PATCH] Registry: Drop settings field It's not used anywhere. --- src/libcmd/common-eval-args.cc | 2 +- src/libcmd/installables.cc | 1 - src/libfetchers/include/nix/fetchers/registry.hh | 9 +++------ src/libfetchers/registry.cc | 16 ++++++++-------- 4 files changed, 12 insertions(+), 16 deletions(-) diff --git a/src/libcmd/common-eval-args.cc b/src/libcmd/common-eval-args.cc index 2cbea16e0..8b9f49266 100644 --- a/src/libcmd/common-eval-args.cc +++ b/src/libcmd/common-eval-args.cc @@ -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); diff --git a/src/libcmd/installables.cc b/src/libcmd/installables.cc index 4548c9725..36777fb9c 100644 --- a/src/libcmd/installables.cc +++ b/src/libcmd/installables.cc @@ -185,7 +185,6 @@ MixFlakeOptions::MixFlakeOptions() } overrideRegistry( - fetchSettings, fetchers::Input::fromAttrs(fetchSettings, {{"type", "indirect"}, {"id", inputName}}), input3->lockedRef.input, extraAttrs); diff --git a/src/libfetchers/include/nix/fetchers/registry.hh b/src/libfetchers/include/nix/fetchers/registry.hh index a403f0318..c9c8b162f 100644 --- a/src/libfetchers/include/nix/fetchers/registry.hh +++ b/src/libfetchers/include/nix/fetchers/registry.hh @@ -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 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, diff --git a/src/libfetchers/registry.cc b/src/libfetchers/registry.cc index b2c8dc237..cb360f03c 100644 --- a/src/libfetchers/registry.cc +++ b/src/libfetchers/registry.cc @@ -14,10 +14,10 @@ std::shared_ptr Registry::read(const Settings & settings, const Source { debug("reading registry '%s'", path); - auto registry = std::make_shared(settings, type); + auto registry = std::make_shared(type); if (!path.pathExists()) - return std::make_shared(settings, type); + return std::make_shared(type); try { @@ -125,15 +125,15 @@ std::shared_ptr getCustomRegistry(const Settings & settings, const Pat return customRegistry; } -std::shared_ptr getFlagRegistry(const Settings & settings) +std::shared_ptr getFlagRegistry() { - static auto flagRegistry = std::make_shared(settings, Registry::Flag); + static auto flagRegistry = std::make_shared(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 getGlobalRegistry(const Settings & settings, Store & store) @@ -141,7 +141,7 @@ static std::shared_ptr getGlobalRegistry(const Settings & settings, St static auto reg = [&]() { auto path = settings.flakeRegistry.get(); if (path == "") { - return std::make_shared(settings, Registry::Global); // empty registry + return std::make_shared(Registry::Global); // empty registry } return Registry::read( @@ -165,7 +165,7 @@ static std::shared_ptr 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));