1
1
Fork 0
mirror of https://github.com/NixOS/nix.git synced 2025-11-18 16:29:36 +01:00

Merge remote-tracking branch 'origin/2.26-maintenance' into sync-with-2.26

This commit is contained in:
Eelco Dolstra 2025-03-05 18:01:03 +01:00
commit 25ba7c55d3
5 changed files with 157 additions and 95 deletions

View file

@ -1088,21 +1088,21 @@ struct CmdFlakeArchive : FlakeCommand, MixJSON, MixDryRun
nlohmann::json jsonObj2 = json ? json::object() : nlohmann::json(nullptr);
for (auto & [inputName, input] : node.inputs) {
if (auto inputNode = std::get_if<0>(&input)) {
if ((*inputNode)->lockedRef.input.isRelative())
continue;
auto storePath =
dryRun
? (*inputNode)->lockedRef.input.computeStorePath(*store)
: (*inputNode)->lockedRef.input.fetchToStore(store).first;
std::optional<StorePath> storePath;
if (!(*inputNode)->lockedRef.input.isRelative()) {
storePath =
dryRun
? (*inputNode)->lockedRef.input.computeStorePath(*store)
: (*inputNode)->lockedRef.input.fetchToStore(store).first;
sources.insert(*storePath);
}
if (json) {
auto & jsonObj3 = jsonObj2[inputName];
jsonObj3["path"] = store->printStorePath(storePath);
sources.insert(std::move(storePath));
if (storePath)
jsonObj3["path"] = store->printStorePath(*storePath);
jsonObj3["inputs"] = traverse(**inputNode);
} else {
sources.insert(std::move(storePath));
} else
traverse(**inputNode);
}
}
}
return jsonObj2;