mirror of
https://github.com/NixOS/nix
synced 2025-06-25 10:41:16 +02:00
nix flake archive: Skip relative path inputs
Fixes #12438.
(cherry picked from commit b4dfeafed5
)
This commit is contained in:
parent
6d3ee99463
commit
d670380bd9
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);
|
nlohmann::json jsonObj2 = json ? json::object() : nlohmann::json(nullptr);
|
||||||
for (auto & [inputName, input] : node.inputs) {
|
for (auto & [inputName, input] : node.inputs) {
|
||||||
if (auto inputNode = std::get_if<0>(&input)) {
|
if (auto inputNode = std::get_if<0>(&input)) {
|
||||||
|
if ((*inputNode)->lockedRef.input.isRelative())
|
||||||
|
continue;
|
||||||
auto storePath =
|
auto storePath =
|
||||||
dryRun
|
dryRun
|
||||||
? (*inputNode)->lockedRef.input.computeStorePath(*store)
|
? (*inputNode)->lockedRef.input.computeStorePath(*store)
|
||||||
: (*inputNode)->lockedRef.input.fetchToStore(store).first;
|
: (*inputNode)->lockedRef.input.fetchToStore(store).first;
|
||||||
if (json) {
|
if (json) {
|
||||||
auto& jsonObj3 = jsonObj2[inputName];
|
auto & jsonObj3 = jsonObj2[inputName];
|
||||||
jsonObj3["path"] = store->printStorePath(storePath);
|
jsonObj3["path"] = store->printStorePath(storePath);
|
||||||
sources.insert(std::move(storePath));
|
sources.insert(std::move(storePath));
|
||||||
jsonObj3["inputs"] = traverse(**inputNode);
|
jsonObj3["inputs"] = traverse(**inputNode);
|
||||||
|
|
|
@ -76,6 +76,9 @@ if ! isTestOnNixOS; then
|
||||||
fi
|
fi
|
||||||
(! grep narHash "$subflake2/flake.lock")
|
(! 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.
|
# Test circular relative path flakes. FIXME: doesn't work at the moment.
|
||||||
if false; then
|
if false; then
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue