aboutsummaryrefslogtreecommitdiff
path: root/src/nix
diff options
context:
space:
mode:
authorEelco Dolstra <edolstra@gmail.com>2018-02-21 16:22:49 +0100
committerEelco Dolstra <edolstra@gmail.com>2018-02-21 16:24:26 +0100
commit0d54671b7b3aa96ab45347e65352979d874346ea (patch)
treef0f56c1c5461128527b86330dc3c5a3f07689dcf /src/nix
parente2d71bd1862cdda65f957c6a6c41016258d9e003 (diff)
Manual: Update chapter on remote builds
Alos add a command "nix ping-store" to make it easier to see if Nix can connect to a remote builder (e.g. 'nix ping-store --store ssh://mac').
Diffstat (limited to 'src/nix')
-rw-r--r--src/nix/ping-store.cc35
1 files changed, 35 insertions, 0 deletions
diff --git a/src/nix/ping-store.cc b/src/nix/ping-store.cc
new file mode 100644
index 000000000..310942574
--- /dev/null
+++ b/src/nix/ping-store.cc
@@ -0,0 +1,35 @@
+#include "command.hh"
+#include "shared.hh"
+#include "store-api.hh"
+
+using namespace nix;
+
+struct CmdPingStore : StoreCommand
+{
+ std::string name() override
+ {
+ return "ping-store";
+ }
+
+ std::string description() override
+ {
+ return "test whether a store can be opened";
+ }
+
+ Examples examples() override
+ {
+ return {
+ Example{
+ "To test whether connecting to a remote Nix store via SSH works:",
+ "nix ping-store --store ssh://mac1"
+ },
+ };
+ }
+
+ void run(ref<Store> store) override
+ {
+ store->connect();
+ }
+};
+
+static RegisterCommand r1(make_ref<CmdPingStore>());