aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEelco Dolstra <edolstra@gmail.com>2020-04-06 14:39:47 +0200
committerEelco Dolstra <edolstra@gmail.com>2020-04-06 14:39:47 +0200
commitce3173edc15ad704c5083baba09b7bcdb99d5104 (patch)
treec0ae895b7b92da532d8a1726b98b60bd0d2aaf36
parent2f494531b7811b45f6b76787f225495a14d28a7f (diff)
nix flake info --json: Don't evaluate
This makes its behaviour consistent with the non-json variant. Querying the outputs should be done by another command (e.g. 'nix search')
-rw-r--r--src/nix/flake.cc35
1 files changed, 5 insertions, 30 deletions
diff --git a/src/nix/flake.cc b/src/nix/flake.cc
index 93dbb9601..03bb9fe37 100644
--- a/src/nix/flake.cc
+++ b/src/nix/flake.cc
@@ -153,39 +153,14 @@ struct CmdFlakeInfo : FlakeCommand, MixJSON
void run(nix::ref<nix::Store> store) override
{
- if (json) {
- auto state = getEvalState();
- auto flake = lockFlake();
-
- auto json = flakeToJson(*store, flake.flake);
-
- auto vFlake = state->allocValue();
- flake::callFlake(*state, flake, *vFlake);
-
- auto outputs = nlohmann::json::object();
-
- enumerateOutputs(*state,
- *vFlake,
- [&](const std::string & name, Value & vProvide, const Pos & pos) {
- auto provide = nlohmann::json::object();
-
- if (name == "checks" || name == "packages") {
- state->forceAttrs(vProvide, pos);
- for (auto & aCheck : *vProvide.attrs)
- provide[aCheck.name] = nlohmann::json::object();
- }
-
- outputs[name] = provide;
- });
-
- json["outputs"] = std::move(outputs);
+ auto flake = getFlake();
+ stopProgressBar();
+ if (json) {
+ auto json = flakeToJson(*store, flake);
std::cout << json.dump() << std::endl;
- } else {
- auto flake = getFlake();
- stopProgressBar();
+ } else
printFlakeInfo(*store, flake);
- }
}
};