mirror of
https://github.com/NixOS/nix
synced 2025-06-25 10:41:16 +02:00
Merge pull request #12554 from NixOS/mergify/bp/2.26-maintenance/pr-12553
nix flake archive: Skip relative path inputs (backport #12553)
This commit is contained in:
commit
31a29e66ea
2 changed files with 6 additions and 1 deletions
|
@ -1088,12 +1088,14 @@ 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;
|
||||
if (json) {
|
||||
auto& jsonObj3 = jsonObj2[inputName];
|
||||
auto & jsonObj3 = jsonObj2[inputName];
|
||||
jsonObj3["path"] = store->printStorePath(storePath);
|
||||
sources.insert(std::move(storePath));
|
||||
jsonObj3["inputs"] = traverse(**inputNode);
|
||||
|
|
|
@ -76,6 +76,9 @@ if ! isTestOnNixOS; then
|
|||
fi
|
||||
(! grep narHash "$subflake2/flake.lock")
|
||||
|
||||
# Test `nix flake archive` with relative path flakes.
|
||||
nix flake archive --json "$rootFlake"
|
||||
|
||||
# Test circular relative path flakes. FIXME: doesn't work at the moment.
|
||||
if false; then
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue