diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/nix/flake.cc | 35 |
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); - } } }; |