mirror of
https://github.com/privatevoid-net/nix-super.git
synced 2024-11-23 14:36:16 +02:00
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
1 changed files with 5 additions and 30 deletions
|
@ -153,40 +153,15 @@ struct CmdFlakeInfo : FlakeCommand, MixJSON
|
||||||
|
|
||||||
void run(nix::ref<nix::Store> store) override
|
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();
|
auto flake = getFlake();
|
||||||
stopProgressBar();
|
stopProgressBar();
|
||||||
|
|
||||||
|
if (json) {
|
||||||
|
auto json = flakeToJson(*store, flake);
|
||||||
|
std::cout << json.dump() << std::endl;
|
||||||
|
} else
|
||||||
printFlakeInfo(*store, flake);
|
printFlakeInfo(*store, flake);
|
||||||
}
|
}
|
||||||
}
|
|
||||||
};
|
};
|
||||||
|
|
||||||
struct CmdFlakeListInputs : FlakeCommand, MixJSON
|
struct CmdFlakeListInputs : FlakeCommand, MixJSON
|
||||||
|
|
Loading…
Reference in a new issue