mirror of
https://github.com/NixOS/nix
synced 2025-06-28 09:31:16 +02:00
Properly filter the stores according to their declared uriSchemes
When opening a store, only try the stores whose `uriSchemes()` include the current one
This commit is contained in:
parent
5895184df4
commit
7f103dcddd
10 changed files with 51 additions and 33 deletions
|
@ -760,7 +760,8 @@ std::list<ref<Store>> getDefaultSubstituters();
|
|||
|
||||
struct StoreFactory
|
||||
{
|
||||
std::function<std::shared_ptr<Store> (const std::string & uri, const Store::Params & params)> create;
|
||||
std::set<std::string> uriSchemes;
|
||||
std::function<std::shared_ptr<Store> (const std::string & scheme, const std::string & uri, const Store::Params & params)> create;
|
||||
std::function<std::shared_ptr<StoreConfig> ()> getConfig;
|
||||
};
|
||||
struct Implementations
|
||||
|
@ -773,13 +774,14 @@ struct Implementations
|
|||
if (!registered) registered = new std::vector<StoreFactory>();
|
||||
StoreFactory factory{
|
||||
.create =
|
||||
([](const std::string & uri, const Store::Params & params)
|
||||
([](const std::string & scheme, const std::string & uri, const Store::Params & params)
|
||||
-> std::shared_ptr<Store>
|
||||
{ return std::make_shared<T>(uri, params); }),
|
||||
{ return std::make_shared<T>(scheme, uri, params); }),
|
||||
.getConfig =
|
||||
([]()
|
||||
-> std::shared_ptr<StoreConfig>
|
||||
{ return std::make_shared<TConfig>(); })
|
||||
{ return std::make_shared<TConfig>(StringMap({})); }),
|
||||
.uriSchemes = T::uriSchemes()
|
||||
};
|
||||
registered->push_back(factory);
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue