diff --git a/src/build-remote/build-remote.cc b/src/build-remote/build-remote.cc index 7329bee5c..a5268bce6 100644 --- a/src/build-remote/build-remote.cc +++ b/src/build-remote/build-remote.cc @@ -16,7 +16,7 @@ #include "nix/store/globals.hh" #include "nix/util/serialise.hh" #include "nix/store/build-result.hh" -#include "nix/store/store-api.hh" +#include "nix/store/store-open.hh" #include "nix/util/strings.hh" #include "nix/store/derivations.hh" #include "nix/store/local-store.hh" diff --git a/src/libcmd/command.cc b/src/libcmd/command.cc index f7aeb739b..31f64fd5a 100644 --- a/src/libcmd/command.cc +++ b/src/libcmd/command.cc @@ -3,7 +3,7 @@ #include "nix/cmd/command.hh" #include "nix/cmd/markdown.hh" -#include "nix/store/store-api.hh" +#include "nix/store/store-open.hh" #include "nix/store/local-fs-store.hh" #include "nix/store/derivations.hh" #include "nix/expr/nixexpr.hh" diff --git a/src/libcmd/common-eval-args.cc b/src/libcmd/common-eval-args.cc index f2881ca2b..e087678c2 100644 --- a/src/libcmd/common-eval-args.cc +++ b/src/libcmd/common-eval-args.cc @@ -9,7 +9,7 @@ #include "nix/fetchers/registry.hh" #include "nix/flake/flakeref.hh" #include "nix/flake/settings.hh" -#include "nix/store/store-api.hh" +#include "nix/store/store-open.hh" #include "nix/cmd/command.hh" #include "nix/fetchers/tarball.hh" #include "nix/fetchers/fetch-to-store.hh" diff --git a/src/libcmd/repl.cc b/src/libcmd/repl.cc index 28d475415..f9ac59d36 100644 --- a/src/libcmd/repl.cc +++ b/src/libcmd/repl.cc @@ -12,7 +12,7 @@ #include "nix/expr/eval-settings.hh" #include "nix/expr/attr-path.hh" #include "nix/util/signals.hh" -#include "nix/store/store-api.hh" +#include "nix/store/store-open.hh" #include "nix/store/log-store.hh" #include "nix/cmd/common-eval-args.hh" #include "nix/expr/get-drvs.hh" diff --git a/src/libexpr/primops/fetchClosure.cc b/src/libexpr/primops/fetchClosure.cc index d28680ae5..4dd8b2606 100644 --- a/src/libexpr/primops/fetchClosure.cc +++ b/src/libexpr/primops/fetchClosure.cc @@ -1,5 +1,5 @@ #include "nix/expr/primops.hh" -#include "nix/store/store-api.hh" +#include "nix/store/store-open.hh" #include "nix/store/realisation.hh" #include "nix/store/make-content-addressed.hh" #include "nix/util/url.hh" diff --git a/src/libstore-c/nix_api_store.cc b/src/libstore-c/nix_api_store.cc index d49e7722b..b7b437e9c 100644 --- a/src/libstore-c/nix_api_store.cc +++ b/src/libstore-c/nix_api_store.cc @@ -5,6 +5,7 @@ #include "nix/store/path.hh" #include "nix/store/store-api.hh" +#include "nix/store/store-open.hh" #include "nix/store/build-result.hh" #include "nix/store/globals.hh" diff --git a/src/libstore-test-support/include/nix/store/tests/libstore.hh b/src/libstore-test-support/include/nix/store/tests/libstore.hh index 466b6f9b1..822ec3aa8 100644 --- a/src/libstore-test-support/include/nix/store/tests/libstore.hh +++ b/src/libstore-test-support/include/nix/store/tests/libstore.hh @@ -5,6 +5,7 @@ #include #include "nix/store/store-api.hh" +#include "nix/store/store-open.hh" namespace nix { diff --git a/src/libstore/build/drv-output-substitution-goal.cc b/src/libstore/build/drv-output-substitution-goal.cc index 0b912357e..c553eeedb 100644 --- a/src/libstore/build/drv-output-substitution-goal.cc +++ b/src/libstore/build/drv-output-substitution-goal.cc @@ -3,6 +3,7 @@ #include "nix/store/build/worker.hh" #include "nix/store/build/substitution-goal.hh" #include "nix/util/callback.hh" +#include "nix/store/store-open.hh" namespace nix { diff --git a/src/libstore/build/substitution-goal.cc b/src/libstore/build/substitution-goal.cc index e24dd7e64..2b4b8ac25 100644 --- a/src/libstore/build/substitution-goal.cc +++ b/src/libstore/build/substitution-goal.cc @@ -1,4 +1,5 @@ #include "nix/store/build/worker.hh" +#include "nix/store/store-open.hh" #include "nix/store/build/substitution-goal.hh" #include "nix/store/nar-info.hh" #include "nix/util/finally.hh" diff --git a/src/libstore/dummy-store.cc b/src/libstore/dummy-store.cc index 68786b31b..819c47bab 100644 --- a/src/libstore/dummy-store.cc +++ b/src/libstore/dummy-store.cc @@ -1,4 +1,4 @@ -#include "nix/store/store-api.hh" +#include "nix/store/store-registration.hh" #include "nix/util/callback.hh" namespace nix { diff --git a/src/libstore/http-binary-cache-store.cc b/src/libstore/http-binary-cache-store.cc index da8b9e18e..2b591dda9 100644 --- a/src/libstore/http-binary-cache-store.cc +++ b/src/libstore/http-binary-cache-store.cc @@ -3,6 +3,7 @@ #include "nix/store/globals.hh" #include "nix/store/nar-info-disk-cache.hh" #include "nix/util/callback.hh" +#include "nix/store/store-registration.hh" namespace nix { diff --git a/src/libstore/include/nix/store/meson.build b/src/libstore/include/nix/store/meson.build index 5298b77a6..c5aa9b461 100644 --- a/src/libstore/include/nix/store/meson.build +++ b/src/libstore/include/nix/store/meson.build @@ -66,16 +66,18 @@ headers = [config_pub_h] + files( 'restricted-store.hh', 's3-binary-cache-store.hh', 's3.hh', - 'ssh-store.hh', 'serve-protocol-connection.hh', 'serve-protocol-impl.hh', 'serve-protocol.hh', 'sqlite.hh', + 'ssh-store.hh', 'ssh.hh', 'store-api.hh', 'store-cast.hh', 'store-dir-config.hh', + 'store-open.hh', 'store-reference.hh', + 'store-registration.hh', 'uds-remote-store.hh', 'worker-protocol-connection.hh', 'worker-protocol-impl.hh', diff --git a/src/libstore/include/nix/store/store-api.hh b/src/libstore/include/nix/store/store-api.hh index fb93c7178..1648b13c1 100644 --- a/src/libstore/include/nix/store/store-api.hh +++ b/src/libstore/include/nix/store/store-api.hh @@ -888,99 +888,6 @@ StorePath resolveDerivedPath(Store &, const SingleDerivedPath &, Store * evalSto OutputPathMap resolveDerivedPath(Store &, const DerivedPath::Built &, Store * evalStore = nullptr); -/** - * @return a Store object to access the Nix store denoted by - * ‘uri’ (slight misnomer...). - */ -ref openStore(StoreReference && storeURI); - - -/** - * Opens the store at `uri`, where `uri` is in the format expected by `StoreReference::parse` - - */ -ref openStore(const std::string & uri = settings.storeUri.get(), - const Store::Config::Params & extraParams = Store::Config::Params()); - - -/** - * @return the default substituter stores, defined by the - * ‘substituters’ option and various legacy options. - */ -std::list> getDefaultSubstituters(); - -struct StoreFactory -{ - /** - * Documentation for this type of store. - */ - std::string doc; - - /** - * URIs with these schemes should be handled by this factory - */ - StringSet uriSchemes; - - /** - * An experimental feature this type store is gated, if it is to be - * experimental. - */ - std::optional experimentalFeature; - - /** - * The `authorityPath` parameter is `/`, or really - * whatever comes after `://` and before `?`. - */ - std::function( - std::string_view scheme, std::string_view authorityPath, const Store::Config::Params & params)> - parseConfig; - - /** - * Just for dumping the defaults. Kind of awkward this exists, - * because it means we cannot require fields to be manually - * specified so easily. - */ - std::function()> getConfig; -}; - -struct Implementations -{ - using Map = std::map; - - static Map & registered(); - - template - static void add() - { - StoreFactory factory{ - .doc = TConfig::doc(), - .uriSchemes = TConfig::uriSchemes(), - .experimentalFeature = TConfig::experimentalFeature(), - .parseConfig = - ([](auto scheme, auto uri, auto & params) - -> ref - { return make_ref(scheme, uri, params); }), - .getConfig = - ([]() -> ref - { return make_ref(Store::Config::Params{}); }), - }; - auto [it, didInsert] = registered().insert({TConfig::name(), std::move(factory)}); - if (!didInsert) { - throw Error("Already registred store with name '%s'", it->first); - } - } -}; - -template -struct RegisterStoreImplementation -{ - RegisterStoreImplementation() - { - Implementations::add(); - } -}; - - /** * Display a set of paths in human-readable form (i.e., between quotes * and separated by commas). diff --git a/src/libstore/include/nix/store/store-open.hh b/src/libstore/include/nix/store/store-open.hh new file mode 100644 index 000000000..8b3460cbf --- /dev/null +++ b/src/libstore/include/nix/store/store-open.hh @@ -0,0 +1,38 @@ +#pragma once +/** + * @file + * + * For opening a store described by an `StoreReference`, which is an "untyped" + * notion which needs to be decoded against a collection of specific + * implementations. + * + * For consumers of the store registration machinery defined in + * `store-registration.hh`. Not needed by store implementation definitions, or + * usages of a given `Store` which will be passed in. + */ + +#include "nix/store/store-api.hh" + +namespace nix { + +/** + * @return a Store object to access the Nix store denoted by + * ‘uri’ (slight misnomer...). + */ +ref openStore(StoreReference && storeURI); + +/** + * Opens the store at `uri`, where `uri` is in the format expected by + * `StoreReference::parse` + */ +ref openStore( + const std::string & uri = settings.storeUri.get(), + const StoreReference::Params & extraParams = StoreReference::Params()); + +/** + * @return the default substituter stores, defined by the + * ‘substituters’ option and various legacy options. + */ +std::list> getDefaultSubstituters(); + +} diff --git a/src/libstore/include/nix/store/store-registration.hh b/src/libstore/include/nix/store/store-registration.hh new file mode 100644 index 000000000..3f82ff51c --- /dev/null +++ b/src/libstore/include/nix/store/store-registration.hh @@ -0,0 +1,88 @@ +#pragma once +/** + * @file + * + * Infrastructure for "registering" store implementations. Used by the + * store implementation definitions themselves but not by consumers of + * those implementations. + * + * Consumers of an arbitrary store from a URL/JSON configuration instead + * just need the defintions `nix/store/store-open.hh`; those do use this + * but only as an implementation. Consumers of a specific extra type of + * store can skip both these, and just use the definition of the store + * in question directly. + */ + +#include "nix/store/store-api.hh" + +namespace nix { + +struct StoreFactory +{ + /** + * Documentation for this type of store. + */ + std::string doc; + + /** + * URIs with these schemes should be handled by this factory + */ + StringSet uriSchemes; + + /** + * An experimental feature this type store is gated, if it is to be + * experimental. + */ + std::optional experimentalFeature; + + /** + * The `authorityPath` parameter is `/`, or really + * whatever comes after `://` and before `?`. + */ + std::function( + std::string_view scheme, std::string_view authorityPath, const Store::Config::Params & params)> + parseConfig; + + /** + * Just for dumping the defaults. Kind of awkward this exists, + * because it means we cannot require fields to be manually + * specified so easily. + */ + std::function()> getConfig; +}; + +struct Implementations +{ + using Map = std::map; + + static Map & registered(); + + template + static void add() + { + StoreFactory factory{ + .doc = TConfig::doc(), + .uriSchemes = TConfig::uriSchemes(), + .experimentalFeature = TConfig::experimentalFeature(), + .parseConfig = ([](auto scheme, auto uri, auto & params) -> ref { + return make_ref(scheme, uri, params); + }), + .getConfig = ([]() -> ref { return make_ref(Store::Config::Params{}); }), + }; + auto [it, didInsert] = registered().insert({TConfig::name(), std::move(factory)}); + if (!didInsert) { + throw Error("Already registred store with name '%s'", it->first); + } + } +}; + +template +struct RegisterStoreImplementation +{ + RegisterStoreImplementation() + { + Implementations::add(); + } +}; + +} diff --git a/src/libstore/legacy-ssh-store.cc b/src/libstore/legacy-ssh-store.cc index 1bddc280d..9ec9e6eec 100644 --- a/src/libstore/legacy-ssh-store.cc +++ b/src/libstore/legacy-ssh-store.cc @@ -12,6 +12,7 @@ #include "nix/store/ssh.hh" #include "nix/store/derivations.hh" #include "nix/util/callback.hh" +#include "nix/store/store-registration.hh" namespace nix { diff --git a/src/libstore/local-binary-cache-store.cc b/src/libstore/local-binary-cache-store.cc index 645cca5f2..2f23135fa 100644 --- a/src/libstore/local-binary-cache-store.cc +++ b/src/libstore/local-binary-cache-store.cc @@ -2,6 +2,7 @@ #include "nix/store/globals.hh" #include "nix/store/nar-info-disk-cache.hh" #include "nix/util/signals.hh" +#include "nix/store/store-registration.hh" #include diff --git a/src/libstore/local-overlay-store.cc b/src/libstore/local-overlay-store.cc index e1a4d40de..e40c5fa6e 100644 --- a/src/libstore/local-overlay-store.cc +++ b/src/libstore/local-overlay-store.cc @@ -1,9 +1,12 @@ +#include + #include "nix/store/local-overlay-store.hh" #include "nix/util/callback.hh" #include "nix/store/realisation.hh" #include "nix/util/processes.hh" #include "nix/util/url.hh" -#include +#include "nix/store/store-open.hh" +#include "nix/store/store-registration.hh" namespace nix { diff --git a/src/libstore/local-store.cc b/src/libstore/local-store.cc index 0293b9af2..76fadba86 100644 --- a/src/libstore/local-store.cc +++ b/src/libstore/local-store.cc @@ -17,6 +17,8 @@ #include "nix/util/posix-source-accessor.hh" #include "nix/store/keys.hh" #include "nix/util/users.hh" +#include "nix/store/store-open.hh" +#include "nix/store/store-registration.hh" #include #include diff --git a/src/libstore/machines.cc b/src/libstore/machines.cc index 0325a6a3a..483b337bf 100644 --- a/src/libstore/machines.cc +++ b/src/libstore/machines.cc @@ -1,6 +1,6 @@ #include "nix/store/machines.hh" #include "nix/store/globals.hh" -#include "nix/store/store-api.hh" +#include "nix/store/store-open.hh" #include diff --git a/src/libstore/meson.build b/src/libstore/meson.build index f3eac04fc..9681a38ab 100644 --- a/src/libstore/meson.build +++ b/src/libstore/meson.build @@ -314,6 +314,7 @@ sources = files( 'ssh.cc', 'store-api.cc', 'store-dir-config.cc', + 'store-registration.cc', 'store-reference.cc', 'uds-remote-store.cc', 'worker-protocol-connection.cc', diff --git a/src/libstore/misc.cc b/src/libstore/misc.cc index c56b2cfe3..967c91d72 100644 --- a/src/libstore/misc.cc +++ b/src/libstore/misc.cc @@ -4,7 +4,7 @@ #include "nix/store/parsed-derivations.hh" #include "nix/store/derivation-options.hh" #include "nix/store/globals.hh" -#include "nix/store/store-api.hh" +#include "nix/store/store-open.hh" #include "nix/util/thread-pool.hh" #include "nix/store/realisation.hh" #include "nix/util/topo-sort.hh" diff --git a/src/libstore/s3-binary-cache-store.cc b/src/libstore/s3-binary-cache-store.cc index 8d8d82465..618112d1c 100644 --- a/src/libstore/s3-binary-cache-store.cc +++ b/src/libstore/s3-binary-cache-store.cc @@ -11,6 +11,7 @@ #include "nix/util/compression.hh" #include "nix/store/filetransfer.hh" #include "nix/util/signals.hh" +#include "nix/store/store-registration.hh" #include #include diff --git a/src/libstore/ssh-store.cc b/src/libstore/ssh-store.cc index 759a537b9..753256d48 100644 --- a/src/libstore/ssh-store.cc +++ b/src/libstore/ssh-store.cc @@ -7,6 +7,7 @@ #include "nix/store/worker-protocol-impl.hh" #include "nix/util/pool.hh" #include "nix/store/ssh.hh" +#include "nix/store/store-registration.hh" namespace nix { diff --git a/src/libstore/store-api.cc b/src/libstore/store-api.cc index 08c542041..c3e9e0e52 100644 --- a/src/libstore/store-api.cc +++ b/src/libstore/store-api.cc @@ -5,6 +5,7 @@ #include "nix/store/realisation.hh" #include "nix/store/derivations.hh" #include "nix/store/store-api.hh" +#include "nix/store/store-open.hh" #include "nix/util/util.hh" #include "nix/store/nar-info-disk-cache.hh" #include "nix/util/thread-pool.hh" @@ -1304,108 +1305,3 @@ void Store::signRealisation(Realisation & realisation) } } - - -#include "nix/store/local-store.hh" -#include "nix/store/uds-remote-store.hh" - - -namespace nix { - -ref openStore(const std::string & uri, - const Store::Config::Params & extraParams) -{ - return openStore(StoreReference::parse(uri, extraParams)); -} - -ref openStore(StoreReference && storeURI) -{ - auto & params = storeURI.params; - - auto storeConfig = std::visit(overloaded { - [&](const StoreReference::Auto &) -> ref { - auto stateDir = getOr(params, "state", settings.nixStateDir); - if (access(stateDir.c_str(), R_OK | W_OK) == 0) - return make_ref(params); - else if (pathExists(settings.nixDaemonSocketFile)) - return make_ref(params); - #ifdef __linux__ - else if (!pathExists(stateDir) - && params.empty() - && !isRootUser() - && !getEnv("NIX_STORE_DIR").has_value() - && !getEnv("NIX_STATE_DIR").has_value()) - { - /* If /nix doesn't exist, there is no daemon socket, and - we're not root, then automatically set up a chroot - store in ~/.local/share/nix/root. */ - auto chrootStore = getDataDir() + "/root"; - if (!pathExists(chrootStore)) { - try { - createDirs(chrootStore); - } catch (SystemError & e) { - return make_ref(params); - } - warn("'%s' does not exist, so Nix will use '%s' as a chroot store", stateDir, chrootStore); - } else - debug("'%s' does not exist, so Nix will use '%s' as a chroot store", stateDir, chrootStore); - return make_ref("local", chrootStore, params); - } - #endif - else - return make_ref(params); - }, - [&](const StoreReference::Specified & g) { - for (const auto & [storeName, implem] : Implementations::registered()) - if (implem.uriSchemes.count(g.scheme)) - return implem.parseConfig(g.scheme, g.authority, params); - - throw Error("don't know how to open Nix store with scheme '%s'", g.scheme); - }, - }, storeURI.variant); - - experimentalFeatureSettings.require(storeConfig->experimentalFeature()); - storeConfig->warnUnknownSettings(); - - auto store = storeConfig->openStore(); - store->init(); - - return store; -} - -std::list> getDefaultSubstituters() -{ - static auto stores([]() { - std::list> stores; - - StringSet done; - - auto addStore = [&](const std::string & uri) { - if (!done.insert(uri).second) return; - try { - stores.push_back(openStore(uri)); - } catch (Error & e) { - logWarning(e.info()); - } - }; - - for (const auto & uri : settings.substituters.get()) - addStore(uri); - - stores.sort([](ref & a, ref & b) { - return a->config.priority < b->config.priority; - }); - - return stores; - } ()); - - return stores; -} - -Implementations::Map & Implementations::registered() -{ - static Map registered; - return registered; -} - -} diff --git a/src/libstore/store-registration.cc b/src/libstore/store-registration.cc new file mode 100644 index 000000000..81cb80cc0 --- /dev/null +++ b/src/libstore/store-registration.cc @@ -0,0 +1,101 @@ +#include "nix/store/store-registration.hh" +#include "nix/store/store-open.hh" +#include "nix/store/local-store.hh" +#include "nix/store/uds-remote-store.hh" + +namespace nix { + +ref openStore(const std::string & uri, const Store::Config::Params & extraParams) +{ + return openStore(StoreReference::parse(uri, extraParams)); +} + +ref openStore(StoreReference && storeURI) +{ + auto & params = storeURI.params; + + auto storeConfig = std::visit( + overloaded{ + [&](const StoreReference::Auto &) -> ref { + auto stateDir = getOr(params, "state", settings.nixStateDir); + if (access(stateDir.c_str(), R_OK | W_OK) == 0) + return make_ref(params); + else if (pathExists(settings.nixDaemonSocketFile)) + return make_ref(params); +#ifdef __linux__ + else if ( + !pathExists(stateDir) && params.empty() && !isRootUser() && !getEnv("NIX_STORE_DIR").has_value() + && !getEnv("NIX_STATE_DIR").has_value()) { + /* If /nix doesn't exist, there is no daemon socket, and + we're not root, then automatically set up a chroot + store in ~/.local/share/nix/root. */ + auto chrootStore = getDataDir() + "/root"; + if (!pathExists(chrootStore)) { + try { + createDirs(chrootStore); + } catch (SystemError & e) { + return make_ref(params); + } + warn("'%s' does not exist, so Nix will use '%s' as a chroot store", stateDir, chrootStore); + } else + debug("'%s' does not exist, so Nix will use '%s' as a chroot store", stateDir, chrootStore); + return make_ref("local", chrootStore, params); + } +#endif + else + return make_ref(params); + }, + [&](const StoreReference::Specified & g) { + for (const auto & [storeName, implem] : Implementations::registered()) + if (implem.uriSchemes.count(g.scheme)) + return implem.parseConfig(g.scheme, g.authority, params); + + throw Error("don't know how to open Nix store with scheme '%s'", g.scheme); + }, + }, + storeURI.variant); + + experimentalFeatureSettings.require(storeConfig->experimentalFeature()); + storeConfig->warnUnknownSettings(); + + auto store = storeConfig->openStore(); + store->init(); + + return store; +} + +std::list> getDefaultSubstituters() +{ + static auto stores([]() { + std::list> stores; + + StringSet done; + + auto addStore = [&](const std::string & uri) { + if (!done.insert(uri).second) + return; + try { + stores.push_back(openStore(uri)); + } catch (Error & e) { + logWarning(e.info()); + } + }; + + for (const auto & uri : settings.substituters.get()) + addStore(uri); + + stores.sort([](ref & a, ref & b) { return a->config.priority < b->config.priority; }); + + return stores; + }()); + + return stores; +} + +Implementations::Map & Implementations::registered() +{ + static Map registered; + return registered; +} + +} diff --git a/src/libstore/uds-remote-store.cc b/src/libstore/uds-remote-store.cc index 480bc5c8a..9950e38b3 100644 --- a/src/libstore/uds-remote-store.cc +++ b/src/libstore/uds-remote-store.cc @@ -1,6 +1,7 @@ #include "nix/store/uds-remote-store.hh" #include "nix/util/unix-domain-socket.hh" #include "nix/store/worker-protocol.hh" +#include "nix/store/store-registration.hh" #include #include diff --git a/src/nix-build/nix-build.cc b/src/nix-build/nix-build.cc index 1becac2b8..80ebf6bfa 100644 --- a/src/nix-build/nix-build.cc +++ b/src/nix-build/nix-build.cc @@ -12,7 +12,7 @@ #include "nix/util/current-process.hh" #include "nix/store/parsed-derivations.hh" #include "nix/store/derivation-options.hh" -#include "nix/store/store-api.hh" +#include "nix/store/store-open.hh" #include "nix/store/local-fs-store.hh" #include "nix/store/globals.hh" #include "nix/store/realisation.hh" diff --git a/src/nix-channel/nix-channel.cc b/src/nix-channel/nix-channel.cc index c0baa4aa2..9db130220 100644 --- a/src/nix-channel/nix-channel.cc +++ b/src/nix-channel/nix-channel.cc @@ -2,7 +2,7 @@ #include "nix/main/shared.hh" #include "nix/store/globals.hh" #include "nix/store/filetransfer.hh" -#include "nix/store/store-api.hh" +#include "nix/store/store-open.hh" #include "nix/cmd/legacy.hh" #include "nix/expr/eval-settings.hh" // for defexpr #include "nix/util/users.hh" diff --git a/src/nix-collect-garbage/nix-collect-garbage.cc b/src/nix-collect-garbage/nix-collect-garbage.cc index 3140bb809..7f86b2b5c 100644 --- a/src/nix-collect-garbage/nix-collect-garbage.cc +++ b/src/nix-collect-garbage/nix-collect-garbage.cc @@ -1,6 +1,6 @@ #include "nix/util/file-system.hh" #include "nix/util/signals.hh" -#include "nix/store/store-api.hh" +#include "nix/store/store-open.hh" #include "nix/store/store-cast.hh" #include "nix/store/gc-store.hh" #include "nix/store/profiles.hh" diff --git a/src/nix-copy-closure/nix-copy-closure.cc b/src/nix-copy-closure/nix-copy-closure.cc index 6d0db1008..87d0f6590 100644 --- a/src/nix-copy-closure/nix-copy-closure.cc +++ b/src/nix-copy-closure/nix-copy-closure.cc @@ -1,6 +1,6 @@ #include "nix/main/shared.hh" #include "nix/store/realisation.hh" -#include "nix/store/store-api.hh" +#include "nix/store/store-open.hh" #include "nix/cmd/legacy.hh" #include "man-pages.hh" diff --git a/src/nix-env/nix-env.cc b/src/nix-env/nix-env.cc index ff629d430..25ff39e38 100644 --- a/src/nix-env/nix-env.cc +++ b/src/nix-env/nix-env.cc @@ -9,7 +9,7 @@ #include "nix/store/profiles.hh" #include "nix/store/path-with-outputs.hh" #include "nix/main/shared.hh" -#include "nix/store/store-api.hh" +#include "nix/store/store-open.hh" #include "nix/store/local-fs-store.hh" #include "user-env.hh" #include "nix/expr/value-to-json.hh" diff --git a/src/nix-instantiate/nix-instantiate.cc b/src/nix-instantiate/nix-instantiate.cc index c1b6cc66a..f7b218efc 100644 --- a/src/nix-instantiate/nix-instantiate.cc +++ b/src/nix-instantiate/nix-instantiate.cc @@ -8,7 +8,7 @@ #include "nix/util/signals.hh" #include "nix/expr/value-to-xml.hh" #include "nix/expr/value-to-json.hh" -#include "nix/store/store-api.hh" +#include "nix/store/store-open.hh" #include "nix/store/local-fs-store.hh" #include "nix/cmd/common-eval-args.hh" #include "nix/cmd/legacy.hh" diff --git a/src/nix-store/nix-store.cc b/src/nix-store/nix-store.cc index 128d57443..9acdf4554 100644 --- a/src/nix-store/nix-store.cc +++ b/src/nix-store/nix-store.cc @@ -2,6 +2,7 @@ #include "nix/store/derivations.hh" #include "dotgraph.hh" #include "nix/store/globals.hh" +#include "nix/store/store-open.hh" #include "nix/store/store-cast.hh" #include "nix/store/local-fs-store.hh" #include "nix/store/log-store.hh" diff --git a/src/nix/flake.cc b/src/nix/flake.cc index 80ff111f1..ea83bb54c 100644 --- a/src/nix/flake.cc +++ b/src/nix/flake.cc @@ -8,7 +8,7 @@ #include "nix/flake/flake.hh" #include "nix/expr/get-drvs.hh" #include "nix/util/signals.hh" -#include "nix/store/store-api.hh" +#include "nix/store/store-open.hh" #include "nix/store/derivations.hh" #include "nix/store/outputs-spec.hh" #include "nix/expr/attr-path.hh" diff --git a/src/nix/log.cc b/src/nix/log.cc index e44f6d69b..78f1dd570 100644 --- a/src/nix/log.cc +++ b/src/nix/log.cc @@ -1,7 +1,7 @@ #include "nix/cmd/command.hh" #include "nix/main/common-args.hh" #include "nix/main/shared.hh" -#include "nix/store/store-api.hh" +#include "nix/store/store-open.hh" #include "nix/store/log-store.hh" using namespace nix; diff --git a/src/nix/main.cc b/src/nix/main.cc index 4a0fa6632..05c5da27d 100644 --- a/src/nix/main.cc +++ b/src/nix/main.cc @@ -7,7 +7,8 @@ #include "nix/store/globals.hh" #include "nix/cmd/legacy.hh" #include "nix/main/shared.hh" -#include "nix/store/store-api.hh" +#include "nix/store/store-open.hh" +#include "nix/store/store-registration.hh" #include "nix/store/filetransfer.hh" #include "nix/util/finally.hh" #include "nix/main/loggers.hh" diff --git a/src/nix/make-content-addressed.cc b/src/nix/make-content-addressed.cc index 292bf42fd..5523ae279 100644 --- a/src/nix/make-content-addressed.cc +++ b/src/nix/make-content-addressed.cc @@ -1,5 +1,5 @@ #include "nix/cmd/command.hh" -#include "nix/store/store-api.hh" +#include "nix/store/store-open.hh" #include "nix/store/make-content-addressed.hh" #include "nix/main/common-args.hh" diff --git a/src/nix/prefetch.cc b/src/nix/prefetch.cc index d56b73bf1..9e5e3c09a 100644 --- a/src/nix/prefetch.cc +++ b/src/nix/prefetch.cc @@ -1,7 +1,7 @@ #include "nix/cmd/command.hh" #include "nix/main/common-args.hh" #include "nix/main/shared.hh" -#include "nix/store/store-api.hh" +#include "nix/store/store-open.hh" #include "nix/store/filetransfer.hh" #include "nix/util/finally.hh" #include "nix/main/loggers.hh" diff --git a/src/nix/repl.cc b/src/nix/repl.cc index fcce43b8f..ca470e99b 100644 --- a/src/nix/repl.cc +++ b/src/nix/repl.cc @@ -2,6 +2,7 @@ #include "nix/expr/eval-settings.hh" #include "nix/util/config-global.hh" #include "nix/store/globals.hh" +#include "nix/store/store-open.hh" #include "nix/cmd/command.hh" #include "nix/cmd/installable-value.hh" #include "nix/cmd/repl.hh" diff --git a/src/nix/sigs.cc b/src/nix/sigs.cc index 9ef54a414..fb868baa1 100644 --- a/src/nix/sigs.cc +++ b/src/nix/sigs.cc @@ -1,7 +1,7 @@ #include "nix/util/signals.hh" #include "nix/cmd/command.hh" #include "nix/main/shared.hh" -#include "nix/store/store-api.hh" +#include "nix/store/store-open.hh" #include "nix/util/thread-pool.hh" #include diff --git a/src/nix/unix/daemon.cc b/src/nix/unix/daemon.cc index 95e84ee72..301f8aa50 100644 --- a/src/nix/unix/daemon.cc +++ b/src/nix/unix/daemon.cc @@ -7,6 +7,7 @@ #include "nix/store/local-store.hh" #include "nix/store/remote-store.hh" #include "nix/store/remote-store-connection.hh" +#include "nix/store/store-open.hh" #include "nix/util/serialise.hh" #include "nix/util/archive.hh" #include "nix/store/globals.hh" diff --git a/src/nix/verify.cc b/src/nix/verify.cc index ff81d78b6..eb2cde93c 100644 --- a/src/nix/verify.cc +++ b/src/nix/verify.cc @@ -1,6 +1,6 @@ #include "nix/cmd/command.hh" #include "nix/main/shared.hh" -#include "nix/store/store-api.hh" +#include "nix/store/store-open.hh" #include "nix/util/thread-pool.hh" #include "nix/util/signals.hh" #include "nix/store/keys.hh" diff --git a/src/perl/lib/Nix/Store.xs b/src/perl/lib/Nix/Store.xs index 34ed8b5f0..edcb6d72a 100644 --- a/src/perl/lib/Nix/Store.xs +++ b/src/perl/lib/Nix/Store.xs @@ -9,7 +9,7 @@ #include "nix/store/derivations.hh" #include "nix/store/realisation.hh" #include "nix/store/globals.hh" -#include "nix/store/store-api.hh" +#include "nix/store/store-open.hh" #include "nix/util/posix-source-accessor.hh" #include diff --git a/tests/functional/test-libstoreconsumer/main.cc b/tests/functional/test-libstoreconsumer/main.cc index 2c0402094..0dc5a5a46 100644 --- a/tests/functional/test-libstoreconsumer/main.cc +++ b/tests/functional/test-libstoreconsumer/main.cc @@ -1,5 +1,5 @@ #include "nix/store/globals.hh" -#include "nix/store/store-api.hh" +#include "nix/store/store-open.hh" #include "nix/store/build-result.hh" #include