forked from lix-project/lix
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')
This commit is contained in:
parent
2f494531b7
commit
ce3173edc1
|
@ -153,40 +153,15 @@ 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);
|
||||
|
||||
std::cout << json.dump() << std::endl;
|
||||
} else {
|
||||
auto flake = getFlake();
|
||||
stopProgressBar();
|
||||
|
||||
if (json) {
|
||||
auto json = flakeToJson(*store, flake);
|
||||
std::cout << json.dump() << std::endl;
|
||||
} else
|
||||
printFlakeInfo(*store, flake);
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
struct CmdFlakeListInputs : FlakeCommand, MixJSON
|
||||
|
|
Loading…
Reference in a new issue