mirror of
https://github.com/NixOS/nix
synced 2025-06-24 22:11:15 +02:00
Factor out resolveStoreConfig
Leverage #10766 to show how we can now resolve a store configuration without actually opening the store for that resolved configuration. Co-authored-by: Robert Hensing <roberth@users.noreply.github.com>
This commit is contained in:
parent
12b7132209
commit
d7481b4b63
2 changed files with 13 additions and 4 deletions
|
@ -15,6 +15,11 @@
|
|||
|
||||
namespace nix {
|
||||
|
||||
/**
|
||||
* @return The store config denoted by `storeURI` (slight misnomer...).
|
||||
*/
|
||||
ref<StoreConfig> resolveStoreConfig(StoreReference && storeURI);
|
||||
|
||||
/**
|
||||
* @return a Store object to access the Nix store denoted by
|
||||
* ‘uri’ (slight misnomer...).
|
||||
|
|
|
@ -11,6 +11,13 @@ ref<Store> openStore(const std::string & uri, const Store::Config::Params & extr
|
|||
}
|
||||
|
||||
ref<Store> openStore(StoreReference && storeURI)
|
||||
{
|
||||
auto store = resolveStoreConfig(std::move(storeURI))->openStore();
|
||||
store->init();
|
||||
return store;
|
||||
}
|
||||
|
||||
ref<StoreConfig> resolveStoreConfig(StoreReference && storeURI)
|
||||
{
|
||||
auto & params = storeURI.params;
|
||||
|
||||
|
@ -58,10 +65,7 @@ ref<Store> openStore(StoreReference && storeURI)
|
|||
experimentalFeatureSettings.require(storeConfig->experimentalFeature());
|
||||
storeConfig->warnUnknownSettings();
|
||||
|
||||
auto store = storeConfig->openStore();
|
||||
store->init();
|
||||
|
||||
return store;
|
||||
return storeConfig;
|
||||
}
|
||||
|
||||
std::list<ref<Store>> getDefaultSubstituters()
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue