1
0
Fork 0
mirror of https://github.com/NixOS/nix synced 2025-06-28 05:21:16 +02:00

flakes: Ensure that self.outPath == ./.

Users expect `self` to refer to the directory where the `flake.nix`
file resides.
This commit is contained in:
Robert Hensing 2023-02-09 22:10:30 +01:00
parent 532c70f531
commit 904a107d16
3 changed files with 86 additions and 2 deletions

View file

@ -9,14 +9,18 @@ let
(key: node:
let
sourceInfo =
rawSourceInfo =
if key == lockFile.root
then rootSrc
else fetchTree (node.info or {} // removeAttrs node.locked ["dir"]);
subdir = if key == lockFile.root then rootSubdir else node.locked.dir or "";
flake = import (sourceInfo + (if subdir != "" then "/" else "") + subdir + "/flake.nix");
outPath = rawSourceInfo + ((if subdir == "" then "" else "/") + subdir);
sourceInfo = rawSourceInfo // { inherit outPath; };
flake = import (outPath + "/flake.nix");
inputs = builtins.mapAttrs
(inputName: inputSpec: allNodes.${resolveInput inputSpec})