about summary refs log tree commit diff
path: root/src/nix/command.cc
diff options
context:
space:
mode:
Diffstat (limited to 'src/nix/command.cc')
-rw-r--r--src/nix/command.cc7
1 files changed, 7 insertions, 0 deletions
diff --git a/src/nix/command.cc b/src/nix/command.cc
index a1b2c120a5d9..4034de96c162 100644
--- a/src/nix/command.cc
+++ b/src/nix/command.cc
@@ -79,6 +79,13 @@ StoreCommand::StoreCommand()
     mkFlag(0, "store", "store-uri", "URI of the Nix store to use", &storeUri);
 }
 
+ref<Store> StoreCommand::getStore()
+{
+    if (!_store)
+        _store = createStore();
+    return ref<Store>(_store);
+}
+
 ref<Store> StoreCommand::createStore()
 {
     return openStore(storeUri);