diff options
author | Eelco Dolstra <edolstra@gmail.com> | 2019-05-16 22:48:16 +0200 |
---|---|---|
committer | Eelco Dolstra <edolstra@gmail.com> | 2019-05-22 14:03:28 +0200 |
commit | 2468672e305faf672c3901c1a9605ca1cb175908 (patch) | |
tree | 1928acc56dd3e6123f004598f7f62625f5f7545a /src/nix/command.hh | |
parent | 8e5c86befcf33786131645f2855de87dd574badc (diff) |
Improve FlakeCommand
It now handles commonality like calling getFlake() and resolving
relative local flake refs.
Fixes #2822.
Diffstat (limited to 'src/nix/command.hh')
-rw-r--r-- | src/nix/command.hh | 37 |
1 files changed, 10 insertions, 27 deletions
diff --git a/src/nix/command.hh b/src/nix/command.hh index 30d869b19..423ac5baa 100644 --- a/src/nix/command.hh +++ b/src/nix/command.hh @@ -35,26 +35,6 @@ struct Buildable typedef std::vector<Buildable> Buildables; -struct GitRepoCommand : virtual Args -{ - std::string gitPath = absPath("."); - - GitRepoCommand () - { - expectArg("git-path", &gitPath, true); - } -}; - -struct FlakeCommand : virtual Args -{ - std::string flakeUri; - - FlakeCommand() - { - expectArg("flake-uri", &flakeUri); - } -}; - struct Installable { virtual std::string what() = 0; @@ -72,7 +52,16 @@ struct Installable } }; -struct SourceExprCommand : virtual Args, StoreCommand, MixEvalArgs +struct EvalCommand : virtual StoreCommand, MixEvalArgs +{ + ref<EvalState> getEvalState(); + +private: + + std::shared_ptr<EvalState> evalState; +}; + +struct SourceExprCommand : virtual Args, EvalCommand { std::optional<Path> file; @@ -84,8 +73,6 @@ struct SourceExprCommand : virtual Args, StoreCommand, MixEvalArgs bool noRegistries = false; - ref<EvalState> getEvalState(); - std::vector<std::shared_ptr<Installable>> parseInstallables( ref<Store> store, std::vector<std::string> ss); @@ -96,10 +83,6 @@ struct SourceExprCommand : virtual Args, StoreCommand, MixEvalArgs { return {"defaultPackage"}; } - -private: - - std::shared_ptr<EvalState> evalState; }; enum RealiseMode { Build, NoBuild, DryRun }; |