forked from lix-project/lix
nix flake info --json: Get rid of duplicate getFlake() call
Also fix some gcc warnings.
This commit is contained in:
parent
893be6f5e3
commit
382aa05ff7
|
@ -174,11 +174,12 @@ static void enumerateOutputs(EvalState & state, Value & vFlake,
|
|||
{
|
||||
state.forceAttrs(vFlake);
|
||||
|
||||
auto vOutputs = (*vFlake.attrs->get(state.symbols.create("outputs")))->value;
|
||||
auto aOutputs = vFlake.attrs->get(state.symbols.create("outputs"));
|
||||
assert(aOutputs);
|
||||
|
||||
state.forceAttrs(*vOutputs);
|
||||
state.forceAttrs(*(*aOutputs)->value);
|
||||
|
||||
for (auto & attr : *vOutputs->attrs)
|
||||
for (auto & attr : *((*aOutputs)->value->attrs))
|
||||
callback(attr.name, *attr.value, *attr.pos);
|
||||
}
|
||||
|
||||
|
@ -191,15 +192,12 @@ struct CmdFlakeInfo : FlakeCommand, MixJSON
|
|||
|
||||
void run(nix::ref<nix::Store> store) override
|
||||
{
|
||||
auto flake = getFlake();
|
||||
stopProgressBar();
|
||||
|
||||
if (json) {
|
||||
auto json = flakeToJson(flake);
|
||||
|
||||
auto state = getEvalState();
|
||||
auto flake = resolveFlake();
|
||||
|
||||
auto json = flakeToJson(flake.flake);
|
||||
|
||||
auto vFlake = state->allocValue();
|
||||
flake::callFlake(*state, flake, *vFlake);
|
||||
|
||||
|
@ -222,9 +220,12 @@ struct CmdFlakeInfo : FlakeCommand, MixJSON
|
|||
json["outputs"] = std::move(outputs);
|
||||
|
||||
std::cout << json.dump() << std::endl;
|
||||
} else
|
||||
} else {
|
||||
auto flake = getFlake();
|
||||
stopProgressBar();
|
||||
printFlakeInfo(flake);
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
struct CmdFlakeCheck : FlakeCommand, MixJSON
|
||||
|
|
|
@ -291,11 +291,12 @@ struct InstallableFlake : InstallableValue
|
|||
|
||||
makeFlakeClosureGCRoot(*state.store, flakeRef, resFlake);
|
||||
|
||||
auto vOutputs = (*vFlake->attrs->get(state.symbols.create("outputs")))->value;
|
||||
auto aOutputs = vFlake->attrs->get(state.symbols.create("outputs"));
|
||||
assert(aOutputs);
|
||||
|
||||
state.forceValue(*vOutputs);
|
||||
state.forceValue(*(*aOutputs)->value);
|
||||
|
||||
return vOutputs;
|
||||
return (*aOutputs)->value;
|
||||
}
|
||||
|
||||
std::vector<flake::EvalCache::Derivation> toDerivations() override
|
||||
|
|
Loading…
Reference in a new issue