diff --git a/src/nix/command.cc b/src/nix/command.cc index 9c80f43093c51142e95d0b67d666bf7ca3e7fa59..0c2103392f8edc43296755332b1c2739f2894b1b 100644 --- a/src/nix/command.cc +++ b/src/nix/command.cc @@ -57,9 +57,16 @@ bool MultiCommand::processArgs(const Strings & args, bool finish) return Args::processArgs(args, finish); } +StoreCommand::StoreCommand() +{ + storeUri = getEnv("NIX_REMOTE"); + + mkFlag(0, "store", "store-uri", "URI of the Nix store to use", &storeUri); +} + void StoreCommand::run() { - run(openStore()); + run(openStoreAt(storeUri)); } } diff --git a/src/nix/command.hh b/src/nix/command.hh index 27c3ab7f21342214d2c628b759297dd00bc3578a..5bf391d9367fd20f216d4f1e4e9603fb315c97b3 100644 --- a/src/nix/command.hh +++ b/src/nix/command.hh @@ -18,9 +18,8 @@ class Store; /* A command that require a Nix store. */ struct StoreCommand : virtual Command { - bool reserveSpace; - StoreCommand(bool reserveSpace = true) - : reserveSpace(reserveSpace) { }; + std::string storeUri; + StoreCommand(); void run() override; virtual void run(ref<Store>) = 0; };