about summary refs log tree commit diff
path: root/src/nix-store/nix-store.cc
diff options
context:
space:
mode:
authorEelco Dolstra <e.dolstra@tudelft.nl>2007-02-20T23·17+0000
committerEelco Dolstra <e.dolstra@tudelft.nl>2007-02-20T23·17+0000
commitb824a1daeefd1611c8d84432dc0b2b38f24bbbfd (patch)
tree85e67cde3c6efea8a1ecd9170c09bc66ac248852 /src/nix-store/nix-store.cc
parent3390c1be76f648ac0b18199c6204a32d1d6d5fbb (diff)
* Start of `nix-store --export' operation for serialising a store
  path.  This is like `nix-store --dump', only it also dumps the
  meta-information of the store path (references, deriver).  Will add
  a `--sign' flag later to add a cryptographic signature, which we
  will use for exchanging store paths between build farm machines in a
  secure manner.

Diffstat (limited to 'src/nix-store/nix-store.cc')
-rw-r--r--src/nix-store/nix-store.cc11
1 files changed, 11 insertions, 0 deletions
diff --git a/src/nix-store/nix-store.cc b/src/nix-store/nix-store.cc
index f0b3f5b615f3..821124324f47 100644
--- a/src/nix-store/nix-store.cc
+++ b/src/nix-store/nix-store.cc
@@ -638,6 +638,15 @@ static void opRestore(Strings opFlags, Strings opArgs)
 }
 
 
+static void opExport(Strings opFlags, Strings opArgs)
+{
+    if (!opFlags.empty()) throw UsageError("unknown flag");
+
+    FdSink sink(STDOUT_FILENO);
+    store->exportPath(*opArgs.begin(), false, sink);
+}
+
+
 /* Initialise the Nix databases. */
 static void opInit(Strings opFlags, Strings opArgs)
 {
@@ -707,6 +716,8 @@ void run(Strings args)
             op = opDump;
         else if (arg == "--restore")
             op = opRestore;
+        else if (arg == "--export")
+            op = opExport;
         else if (arg == "--init")
             op = opInit;
         else if (arg == "--verify")