mirror of
https://github.com/NixOS/nix
synced 2025-06-24 22:11:15 +02:00
Use correct parent outPath
for relative path inputs
Ensure relative path inputs are relative to the parent node's _actual_ `outPath`, instead of the subtly different `sourceInfo.outPath`. Additionally, non-flake inputs now also have a `sourceInfo` attribute. This fixes the relationship between `self.outPath` and `self.sourceInfo.outPath` in some edge cases. Fixes #13164
This commit is contained in:
parent
cdbe788c1f
commit
46beb9af76
1 changed files with 11 additions and 15 deletions
|
@ -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;
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue