Skip to content

Commit e1262c7

Browse files
authored
Merge pull request #59 from hercules-ci/port-nix-7796-flake-outPath
nix#7796: Ensure that `self.outPath == ./.`
2 parents 2bf43d6 + bc5e257 commit e1262c7

1 file changed

Lines changed: 17 additions & 2 deletions

File tree

default.nix

Lines changed: 17 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -149,7 +149,9 @@ let
149149

150150
subdir = if key == lockFile.root then "" else node.locked.dir or "";
151151

152-
flake = import (sourceInfo + (if subdir != "" then "/" else "") + subdir + "/flake.nix");
152+
outPath = sourceInfo + ((if subdir == "" then "" else "/") + subdir);
153+
154+
flake = import (outPath + "/flake.nix");
153155

154156
inputs = builtins.mapAttrs
155157
(inputName: inputSpec: allNodes.${resolveInput inputSpec})
@@ -176,7 +178,20 @@ let
176178

177179
outputs = flake.outputs (inputs // { self = result; });
178180

179-
result = outputs // sourceInfo // { inherit inputs; inherit outputs; inherit sourceInfo; _type = "flake"; };
181+
result =
182+
outputs
183+
# We add the sourceInfo attribute for its metadata, as they are
184+
# relevant metadata for the flake. However, the outPath of the
185+
# sourceInfo does not necessarily match the outPath of the flake,
186+
# as the flake may be in a subdirectory of a source.
187+
# This is shadowed in the next //
188+
// sourceInfo
189+
// {
190+
# This shadows the sourceInfo.outPath
191+
inherit outPath;
192+
193+
inherit inputs; inherit outputs; inherit sourceInfo; _type = "flake";
194+
};
180195

181196
in
182197
if node.flake or true then

0 commit comments

Comments
 (0)