diff options
author | julia <midnight@trainwit.ch> | 2024-05-15 19:11:32 +1000 |
---|---|---|
committer | julia <midnight@trainwit.ch> | 2024-05-18 12:27:23 +1000 |
commit | 7a3745b07607d3fc85fb5a0a08832ab078080884 (patch) | |
tree | bc82a0a28077bb320a7a32c9d4bc7de9b213b47d /src/libfetchers/registry.cc | |
parent | 236466faf385f98f3639ec04147c171774d03726 (diff) |
Deprecate the online flake registries and vendor the default registry
Fixes #183, #110, #116.
The default flake-registry option becomes 'vendored', and refers
to a vendored flake-registry.json file in the install path.
Vendored copy of the flake-registry is from github:NixOS/flake-registry
at commit 9c69f7bd2363e71fe5cd7f608113290c7614dcdd.
Change-Id: I752b81c85ebeaab4e582ac01c239d69d65580f37
Diffstat (limited to 'src/libfetchers/registry.cc')
-rw-r--r-- | src/libfetchers/registry.cc | 10 |
1 files changed, 9 insertions, 1 deletions
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"); |