about summary refs log tree commit diff
path: root/src/nix
diff options
context:
space:
mode:
authorEelco Dolstra <edolstra@gmail.com>2017-09-08T13·32+0200
committerEelco Dolstra <edolstra@gmail.com>2017-09-08T13·32+0200
commite02edb14836fda29019adf95073092d874ebd925 (patch)
treebde2e6e39742f26572cdb86d47fb7544ecad6b46 /src/nix
parentb7376edf06e3836394503e16ec14af23c7615f22 (diff)
nix copy: Add --substitute flag
Diffstat (limited to 'src/nix')
-rw-r--r--src/nix/copy.cc10
1 files changed, 9 insertions, 1 deletions
diff --git a/src/nix/copy.cc b/src/nix/copy.cc
index bf9ffe75569f..8d7c6a0e8e4c 100644
--- a/src/nix/copy.cc
+++ b/src/nix/copy.cc
@@ -14,6 +14,8 @@ struct CmdCopy : StorePathsCommand
 
     CheckSigsFlag checkSigs = CheckSigs;
 
+    SubstituteFlag substitute = NoSubstitute;
+
     CmdCopy()
     {
         mkFlag(0, "from", "store-uri", "URI of the source Nix store", &srcUri);
@@ -23,6 +25,12 @@ struct CmdCopy : StorePathsCommand
             .longName("no-check-sigs")
             .description("do not require that paths are signed by trusted keys")
             .set(&checkSigs, NoCheckSigs);
+
+        mkFlag()
+            .longName("substitute")
+            .shortName('s')
+            .description("whether to try substitutes on the destination store (only supported by SSH)")
+            .set(&substitute, Substitute);
     }
 
     std::string name() override
@@ -66,7 +74,7 @@ struct CmdCopy : StorePathsCommand
         ref<Store> dstStore = dstUri.empty() ? openStore() : openStore(dstUri);
 
         copyPaths(srcStore, dstStore, PathSet(storePaths.begin(), storePaths.end()),
-            NoRepair, checkSigs);
+            NoRepair, checkSigs, substitute);
     }
 };