diff options
author | Eelco Dolstra <edolstra@gmail.com> | 2019-04-24 12:47:35 +0200 |
---|---|---|
committer | Eelco Dolstra <edolstra@gmail.com> | 2019-04-24 12:47:35 +0200 |
commit | 21d5abfc146bdc69d631d47de2cdcfdd18cc228c (patch) | |
tree | 463eae782d2e2378b47624ffa1d859716143f67c /src/nix/flake.cc | |
parent | cc51e37ad09a1dac0a58c543ffe275ddc18819aa (diff) | |
parent | b42ba08fc8a291c549c1f9f92457d72639fac995 (diff) |
Merge remote-tracking branch 'tweag/flake-clone' into flakes
Diffstat (limited to 'src/nix/flake.cc')
-rw-r--r-- | src/nix/flake.cc | 29 |
1 files changed, 29 insertions, 0 deletions
diff --git a/src/nix/flake.cc b/src/nix/flake.cc index acba912e5..6459df019 100644 --- a/src/nix/flake.cc +++ b/src/nix/flake.cc @@ -284,6 +284,34 @@ struct CmdFlakeInit : virtual Args, Command } }; +struct CmdFlakeClone : StoreCommand, FlakeCommand, MixEvalArgs +{ + Path endDirectory = ""; + + std::string name() override + { + return "clone"; + } + + std::string description() override + { + return "clone flake repository"; + } + + CmdFlakeClone() + { + expectArg("end-dir", &endDirectory, true); + } + + void run(nix::ref<nix::Store> store) override + { + auto evalState = std::make_shared<EvalState>(searchPath, store); + + Registries registries = evalState->getFlakeRegistries(); + gitCloneFlake(flakeUri, *evalState, registries, endDirectory); + } +}; + struct CmdFlake : virtual MultiCommand, virtual Command { CmdFlake() @@ -295,6 +323,7 @@ struct CmdFlake : virtual MultiCommand, virtual Command , make_ref<CmdFlakeRemove>() , make_ref<CmdFlakePin>() , make_ref<CmdFlakeInit>() + , make_ref<CmdFlakeClone>() }) { } |