aboutsummaryrefslogtreecommitdiff
path: root/src/libstore/dummy-store.cc
diff options
context:
space:
mode:
Diffstat (limited to 'src/libstore/dummy-store.cc')
-rw-r--r--src/libstore/dummy-store.cc18
1 files changed, 7 insertions, 11 deletions
diff --git a/src/libstore/dummy-store.cc b/src/libstore/dummy-store.cc
index 7a5744bc1..a677e201e 100644
--- a/src/libstore/dummy-store.cc
+++ b/src/libstore/dummy-store.cc
@@ -2,17 +2,15 @@
namespace nix {
-static std::string uriScheme = "dummy://";
-
struct DummyStore : public Store
{
- DummyStore(const Params & params)
+ DummyStore(const std::string uri, const Params & params)
: Store(params)
{ }
string getUri() override
{
- return uriScheme;
+ return uriPrefixes()[0] + "://";
}
void queryPathInfoUncached(const StorePath & path,
@@ -21,6 +19,10 @@ struct DummyStore : public Store
callback(nullptr);
}
+ static std::vector<std::string> uriPrefixes() {
+ return {"dummy"};
+ }
+
std::optional<StorePath> queryPathFromHashPart(const std::string & hashPart) override
{ unsupported("queryPathFromHashPart"); }
@@ -48,12 +50,6 @@ struct DummyStore : public Store
{ unsupported("buildDerivation"); }
};
-static RegisterStoreImplementation regStore([](
- const std::string & uri, const Store::Params & params)
- -> std::shared_ptr<Store>
-{
- if (uri != uriScheme) return nullptr;
- return std::make_shared<DummyStore>(params);
-});
+[[maybe_unused]] static RegisterStoreImplementation<DummyStore> regStore();
}