mirror of
https://github.com/NixOS/nix
synced 2025-07-06 21:41:48 +02:00
nix flake archive: Recurse into relative path inputs
We can't ignore them entirely, since we do want to archive their transitive inputs. Fixes #12438.
This commit is contained in:
parent
d433a2242e
commit
14c9755462
3 changed files with 34 additions and 16 deletions
|
@ -1090,21 +1090,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;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue