diff options
author | Benoit de Chezelles <benoit.dechezelles@gmail.com> | 2021-10-28 00:56:36 +0200 |
---|---|---|
committer | Benoit de Chezelles <benoit.dechezelles@gmail.com> | 2022-12-12 15:32:02 +0100 |
commit | a456630a5a93db170bbc5570ae0e1a48a16cbe09 (patch) | |
tree | ff0bd385f28f7d862cf86857f49efa611b7ab748 /src/libfetchers | |
parent | 11ef807c22acb3232f5ccf5f1c9a53b55280bd6c (diff) |
Allow to disable global flake-registry with ""
Diffstat (limited to 'src/libfetchers')
-rw-r--r-- | src/libfetchers/fetch-settings.hh | 7 | ||||
-rw-r--r-- | src/libfetchers/registry.cc | 3 |
2 files changed, 9 insertions, 1 deletions
diff --git a/src/libfetchers/fetch-settings.hh b/src/libfetchers/fetch-settings.hh index 6452143a1..f33cbdcfc 100644 --- a/src/libfetchers/fetch-settings.hh +++ b/src/libfetchers/fetch-settings.hh @@ -71,7 +71,12 @@ struct FetchSettings : public Config "Whether to warn about dirty Git/Mercurial trees."}; Setting<std::string> flakeRegistry{this, "https://channels.nixos.org/flake-registry.json", "flake-registry", - "Path or URI of the global flake registry."}; + R"( + Path or URI of the global flake registry. + + When empty, disables the global flake registry. + )"}; + Setting<bool> useRegistries{this, true, "use-registries", "Whether to use flake registries to resolve flake references."}; diff --git a/src/libfetchers/registry.cc b/src/libfetchers/registry.cc index acd1ff866..43c03beec 100644 --- a/src/libfetchers/registry.cc +++ b/src/libfetchers/registry.cc @@ -153,6 +153,9 @@ static std::shared_ptr<Registry> getGlobalRegistry(ref<Store> store) { static auto reg = [&]() { auto path = fetchSettings.flakeRegistry.get(); + if (path == "") { + return std::make_shared<Registry>(Registry::Global); // empty registry + } if (!hasPrefix(path, "/")) { auto storePath = downloadFile(store, path, "flake-registry.json", false).storePath; |