mirror of
https://github.com/privatevoid-net/nix-super.git
synced 2024-11-27 08:16:14 +02:00
nix flake deps: Print flake dependencies
This commit is contained in:
parent
70136a9bf4
commit
3e8ef9eb22
1 changed files with 8 additions and 8 deletions
|
@ -70,7 +70,7 @@ struct CmdFlakeList : EvalCommand
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
void printFlakeInfo(Flake & flake, bool json) {
|
void printFlakeInfo(const Flake & flake, bool json) {
|
||||||
if (json) {
|
if (json) {
|
||||||
nlohmann::json j;
|
nlohmann::json j;
|
||||||
j["id"] = flake.id;
|
j["id"] = flake.id;
|
||||||
|
@ -98,7 +98,7 @@ void printFlakeInfo(Flake & flake, bool json) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void printNonFlakeInfo(NonFlake & nonFlake, bool json) {
|
void printNonFlakeInfo(const NonFlake & nonFlake, bool json) {
|
||||||
if (json) {
|
if (json) {
|
||||||
nlohmann::json j;
|
nlohmann::json j;
|
||||||
j["id"] = nonFlake.alias;
|
j["id"] = nonFlake.alias;
|
||||||
|
@ -142,20 +142,20 @@ struct CmdFlakeDeps : FlakeCommand, MixJSON
|
||||||
auto evalState = getEvalState();
|
auto evalState = getEvalState();
|
||||||
evalState->addRegistryOverrides(registryOverrides);
|
evalState->addRegistryOverrides(registryOverrides);
|
||||||
|
|
||||||
auto resFlake = resolveFlake();
|
|
||||||
|
|
||||||
std::queue<ResolvedFlake> todo;
|
std::queue<ResolvedFlake> todo;
|
||||||
todo.push(resFlake);
|
todo.push(resolveFlake());
|
||||||
|
|
||||||
while (!todo.empty()) {
|
while (!todo.empty()) {
|
||||||
resFlake = todo.front();
|
auto resFlake = std::move(todo.front());
|
||||||
todo.pop();
|
todo.pop();
|
||||||
|
|
||||||
for (NonFlake & nonFlake : resFlake.nonFlakeDeps)
|
for (auto & nonFlake : resFlake.nonFlakeDeps)
|
||||||
printNonFlakeInfo(nonFlake, json);
|
printNonFlakeInfo(nonFlake, json);
|
||||||
|
|
||||||
for (auto info : resFlake.flakeDeps)
|
for (auto & info : resFlake.flakeDeps) {
|
||||||
|
printFlakeInfo(info.second.flake, json);
|
||||||
todo.push(info.second);
|
todo.push(info.second);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
Loading…
Reference in a new issue