From cebc150b7ccf534612d7d8c75200c1717e986566 Mon Sep 17 00:00:00 2001 From: Eelco Dolstra Date: Mon, 21 Mar 2016 18:03:36 +0100 Subject: [PATCH] nix: Add --store flag This is a bit user-friendlier than using $NIX_REMOTE. --- src/nix/command.cc | 9 ++++++++- src/nix/command.hh | 5 ++--- 2 files changed, 10 insertions(+), 4 deletions(-) diff --git a/src/nix/command.cc b/src/nix/command.cc index 9c80f4309..0c2103392 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 27c3ab7f2..5bf391d93 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) = 0; };