1
0
Fork 0
mirror of https://github.com/NixOS/nix synced 2025-06-28 22:01:15 +02:00

Merge pull request #13170 from MattSturgeon/fix/call-flake/rel-path

Use correct parent `outPath` for relative path inputs
This commit is contained in:
Robert Hensing 2025-05-19 14:13:54 +02:00 committed by GitHub
commit f18af849fe
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
4 changed files with 117 additions and 15 deletions

View file

@ -39,24 +39,16 @@ let
allNodes = mapAttrs (
key: node:
let
hasOverride = overrides ? ${key};
isRelative = node.locked.type or null == "path" && builtins.substring 0 1 node.locked.path != "/";
parentNode = allNodes.${getInputByPath lockFile.root node.parent};
flakeDir =
let
dir = overrides.${key}.dir or node.locked.path or "";
parentDir = parentNode.flakeDir;
in
if node ? parent then parentDir + ("/" + dir) else dir;
sourceInfo =
if overrides ? ${key} then
if hasOverride then
overrides.${key}.sourceInfo
else if node.locked.type == "path" && builtins.substring 0 1 node.locked.path != "/" then
else if isRelative then
parentNode.sourceInfo
// {
outPath = parentNode.sourceInfo.outPath + ("/" + flakeDir);
}
else
# FIXME: remove obsolete node.info.
# Note: lock file entries are always final.
@ -64,7 +56,11 @@ let
subdir = overrides.${key}.dir or node.locked.dir or "";
outPath = sourceInfo + ((if subdir == "" then "" else "/") + subdir);
outPath =
if !hasOverride && isRelative then
parentNode.outPath + (if node.locked.path == "" then "" else "/" + node.locked.path)
else
sourceInfo.outPath + (if subdir == "" then "" else "/" + subdir);
flake = import (outPath + "/flake.nix");
@ -99,9 +95,9 @@ let
assert builtins.isFunction flake.outputs;
result
else
sourceInfo;
sourceInfo // { inherit sourceInfo outPath; };
inherit flakeDir sourceInfo;
inherit outPath sourceInfo;
}
) lockFile.nodes;