diff options
author | Nick Van den Broeck <nick.van.den.broeck666@gmail.com> | 2019-03-21 09:30:16 +0100 |
---|---|---|
committer | Nick Van den Broeck <nick.van.den.broeck666@gmail.com> | 2019-04-17 13:31:09 +0200 |
commit | b42ba08fc8a291c549c1f9f92457d72639fac995 (patch) | |
tree | 8d630e5f9bbd84322d08e8b33c56afd345c6e2da /src/nix | |
parent | 939bee06cd7c68af1508fab127202689fc63c22e (diff) |
Add command `flake clone`
Diffstat (limited to 'src/nix')
-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 4b8f1026e..35324295d 100644 --- a/src/nix/flake.cc +++ b/src/nix/flake.cc @@ -280,6 +280,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() @@ -291,6 +319,7 @@ struct CmdFlake : virtual MultiCommand, virtual Command , make_ref<CmdFlakeRemove>() , make_ref<CmdFlakePin>() , make_ref<CmdFlakeInit>() + , make_ref<CmdFlakeClone>() }) { } |