about summary refs log tree commit diff
path: root/src/nix/command.cc
diff options
context:
space:
mode:
authorEelco Dolstra <edolstra@gmail.com>2017-05-04T12·16+0200
committerEelco Dolstra <edolstra@gmail.com>2017-05-04T12·21+0200
commit2da6a424486e16b4b30e448a15a9b4a608df602d (patch)
tree714f354bd9df41fd4b9ef3f5d391fc64aa1003bc /src/nix/command.cc
parent44309c506767fcfb8aae15761b329a87b0dd4b8c (diff)
nix dump-path: Add
This is primarily useful for extracting NARs from other stores (like
binary caches), which "nix-store --dump" cannot do.
Diffstat (limited to 'src/nix/command.cc')
-rw-r--r--src/nix/command.cc10
1 files changed, 10 insertions, 0 deletions
diff --git a/src/nix/command.cc b/src/nix/command.cc
index a45f2888bfb5..3c82e0df57f7 100644
--- a/src/nix/command.cc
+++ b/src/nix/command.cc
@@ -129,4 +129,14 @@ void StorePathsCommand::run(ref<Store> store)
     run(store, storePaths);
 }
 
+void StorePathCommand::run(ref<Store> store)
+{
+    auto storePaths = buildInstallables(store, false);
+
+    if (storePaths.size() != 1)
+        throw UsageError("this command requires exactly one store path");
+
+    run(store, *storePaths.begin());
+}
+
 }