aboutsummaryrefslogtreecommitdiff
path: root/src/nix/copy.cc
diff options
context:
space:
mode:
Diffstat (limited to 'src/nix/copy.cc')
-rw-r--r--src/nix/copy.cc37
1 files changed, 2 insertions, 35 deletions
diff --git a/src/nix/copy.cc b/src/nix/copy.cc
index 197c85316..8730a9a5c 100644
--- a/src/nix/copy.cc
+++ b/src/nix/copy.cc
@@ -1,17 +1,11 @@
#include "command.hh"
#include "shared.hh"
#include "store-api.hh"
-#include "sync.hh"
-#include "thread-pool.hh"
-
-#include <atomic>
using namespace nix;
-struct CmdCopy : BuiltPathsCommand
+struct CmdCopy : virtual CopyCommand, virtual BuiltPathsCommand
{
- std::string srcUri, dstUri;
-
CheckSigsFlag checkSigs = CheckSigs;
SubstituteFlag substitute = NoSubstitute;
@@ -22,20 +16,6 @@ struct CmdCopy : BuiltPathsCommand
: BuiltPathsCommand(true)
{
addFlag({
- .longName = "from",
- .description = "URL of the source Nix store.",
- .labels = {"store-uri"},
- .handler = {&srcUri},
- });
-
- addFlag({
- .longName = "to",
- .description = "URL of the destination Nix store.",
- .labels = {"store-uri"},
- .handler = {&dstUri},
- });
-
- addFlag({
.longName = "no-check-sigs",
.description = "Do not require that paths are signed by trusted keys.",
.handler = {&checkSigs, NoCheckSigs},
@@ -65,22 +45,9 @@ struct CmdCopy : BuiltPathsCommand
Category category() override { return catSecondary; }
- ref<Store> createStore() override
- {
- return srcUri.empty() ? StoreCommand::createStore() : openStore(srcUri);
- }
-
- void run(ref<Store> store) override
- {
- if (srcUri.empty() && dstUri.empty())
- throw UsageError("you must pass '--from' and/or '--to'");
-
- BuiltPathsCommand::run(store);
- }
-
void run(ref<Store> srcStore, BuiltPaths && paths) override
{
- ref<Store> dstStore = dstUri.empty() ? openStore() : openStore(dstUri);
+ auto dstStore = getDstStore();
RealisedPath::Set stuffToCopy;