about summary refs log tree commit diff
path: root/src/nix-store
diff options
context:
space:
mode:
Diffstat (limited to 'src/nix-store')
-rw-r--r--src/nix-store/nix-store.cc12
1 files changed, 12 insertions, 0 deletions
diff --git a/src/nix-store/nix-store.cc b/src/nix-store/nix-store.cc
index 7b56de7e4d64..61ae4cf4f925 100644
--- a/src/nix-store/nix-store.cc
+++ b/src/nix-store/nix-store.cc
@@ -651,6 +651,16 @@ static void opExport(Strings opFlags, Strings opArgs)
 }
 
 
+static void opImport(Strings opFlags, Strings opArgs)
+{
+    if (!opFlags.empty()) throw UsageError("unknown flag");
+    if (!opArgs.empty()) throw UsageError("no arguments expected");
+    
+    FdSource source(STDIN_FILENO);
+    cout << format("%1%\n") % store->importPath(false, source);
+}
+
+
 /* Initialise the Nix databases. */
 static void opInit(Strings opFlags, Strings opArgs)
 {
@@ -722,6 +732,8 @@ void run(Strings args)
             op = opRestore;
         else if (arg == "--export")
             op = opExport;
+        else if (arg == "--import")
+            op = opImport;
         else if (arg == "--init")
             op = opInit;
         else if (arg == "--verify")