From ce3173edc15ad704c5083baba09b7bcdb99d5104 Mon Sep 17 00:00:00 2001 From: Eelco Dolstra Date: Mon, 6 Apr 2020 14:39:47 +0200 Subject: [PATCH] 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') --- src/nix/flake.cc | 35 +++++------------------------------ 1 file 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 store) override { + auto flake = getFlake(); + stopProgressBar(); + 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 json = flakeToJson(*store, flake); std::cout << json.dump() << std::endl; - } else { - auto flake = getFlake(); - stopProgressBar(); + } else printFlakeInfo(*store, flake); - } } };