mirror of
https://github.com/NixOS/nix.git
synced 2025-12-05 16:41:01 +01:00
Split out a new libnixflake
Co-authored-by: Robert Hensing <roberth@users.noreply.github.com>
This commit is contained in:
parent
52730d38e2
commit
0084a486cc
23 changed files with 153 additions and 52 deletions
|
|
@ -1,12 +1,11 @@
|
|||
#include "registry.hh"
|
||||
#include "tarball.hh"
|
||||
#include "users.hh"
|
||||
#include "config-global.hh"
|
||||
#include "globals.hh"
|
||||
#include "store-api.hh"
|
||||
#include "local-fs-store.hh"
|
||||
|
||||
#include "fetch-settings.hh"
|
||||
|
||||
#include <nlohmann/json.hpp>
|
||||
|
||||
namespace nix::fetchers {
|
||||
|
|
@ -149,10 +148,25 @@ void overrideRegistry(
|
|||
flagRegistry->add(from, to, extraAttrs);
|
||||
}
|
||||
|
||||
struct RegistrySettings : Config
|
||||
{
|
||||
Setting<std::string> flakeRegistry{this, "https://channels.nixos.org/flake-registry.json", "flake-registry",
|
||||
R"(
|
||||
Path or URI of the global flake registry.
|
||||
|
||||
When empty, disables the global flake registry.
|
||||
)",
|
||||
{}, true, Xp::Flakes};
|
||||
};
|
||||
|
||||
RegistrySettings registrySettings;
|
||||
|
||||
static GlobalConfig::Register rRegistrySettings(®istrySettings);
|
||||
|
||||
static std::shared_ptr<Registry> getGlobalRegistry(ref<Store> store)
|
||||
{
|
||||
static auto reg = [&]() {
|
||||
auto path = fetchSettings.flakeRegistry.get();
|
||||
auto path = registrySettings.flakeRegistry.get();
|
||||
if (path == "") {
|
||||
return std::make_shared<Registry>(Registry::Global); // empty registry
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue