From 9c4e05766bb7f3776cfc5eb1a3da358419a65406 Mon Sep 17 00:00:00 2001 From: Eelco Dolstra Date: Wed, 29 Apr 2020 15:50:59 +0200 Subject: [PATCH] nix copy: Move --from / --to check This means you now get an error message *before* stuff gets built: $ nix copy .#hydraJobs.vendoredCrates error: you must pass '--from' and/or '--to' Try 'nix --help' for more information. --- src/nix/copy.cc | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/nix/copy.cc b/src/nix/copy.cc index 85c777d38..66993ac21 100644 --- a/src/nix/copy.cc +++ b/src/nix/copy.cc @@ -80,11 +80,16 @@ struct CmdCopy : StorePathsCommand return srcUri.empty() ? StoreCommand::createStore() : openStore(srcUri); } - void run(ref srcStore, StorePaths storePaths) override + void run(ref store) override { if (srcUri.empty() && dstUri.empty()) throw UsageError("you must pass '--from' and/or '--to'"); + StorePathsCommand::run(store); + } + + void run(ref srcStore, StorePaths storePaths) override + { ref dstStore = dstUri.empty() ? openStore() : openStore(dstUri); copyPaths(srcStore, dstStore, storePathsToSet(storePaths),