diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/libfetchers/fetch-settings.hh | 5 | ||||
-rw-r--r-- | src/libfetchers/registry.cc | 10 |
2 files changed, 13 insertions, 2 deletions
diff --git a/src/libfetchers/fetch-settings.hh b/src/libfetchers/fetch-settings.hh index 6108a179c..c67a75082 100644 --- a/src/libfetchers/fetch-settings.hh +++ b/src/libfetchers/fetch-settings.hh @@ -71,10 +71,13 @@ struct FetchSettings : public Config Setting<bool> warnDirty{this, true, "warn-dirty", "Whether to warn about dirty Git/Mercurial trees."}; - Setting<std::string> flakeRegistry{this, "https://channels.nixos.org/flake-registry.json", "flake-registry", + Setting<std::string> flakeRegistry{this, "vendored", "flake-registry", R"( Path or URI of the global flake registry. + URIs are deprecated. When set to 'vendored', defaults to a vendored + copy of https://channels.nixos.org/flake-registry.json. + When empty, disables the global flake registry. )", {}, true, Xp::Flakes}; diff --git a/src/libfetchers/registry.cc b/src/libfetchers/registry.cc index da92273d6..4b2d61f52 100644 --- a/src/libfetchers/registry.cc +++ b/src/libfetchers/registry.cc @@ -16,8 +16,12 @@ std::shared_ptr<Registry> Registry::read( { auto registry = std::make_shared<Registry>(type); - if (!pathExists(path)) + if (!pathExists(path)) { + if (type == RegistryType::Global) { + warn("cannot read flake registry '%s': path does not exist", path); + } return std::make_shared<Registry>(type); + } try { @@ -155,9 +159,13 @@ static std::shared_ptr<Registry> getGlobalRegistry(ref<Store> store) auto path = fetchSettings.flakeRegistry.get(); if (path == "") { return std::make_shared<Registry>(Registry::Global); // empty registry + } else if (path == "vendored") { + return Registry::read(settings.nixDataDir + "/flake-registry.json", Registry::Global); } if (!path.starts_with("/")) { + warn("config option flake-registry referring to a URL is deprecated and will be removed in Lix 3.0; yours is: `%s'", path); + auto storePath = downloadFile(store, path, "flake-registry.json", false).storePath; if (auto store2 = store.dynamic_pointer_cast<LocalFSStore>()) store2->addPermRoot(storePath, getCacheDir() + "/nix/flake-registry.json"); |