aboutsummaryrefslogtreecommitdiff
path: root/src/libexpr/flake/call-flake.nix
diff options
context:
space:
mode:
authorRobert Hensing <robert@roberthensing.nl>2023-02-09 22:10:30 +0100
committerRobert Hensing <robert@roberthensing.nl>2023-02-22 03:30:47 +0100
commit904a107d16b69f28b9d61c677eb27b953d421a54 (patch)
tree7d43c137adb9844e8fb5e5ed433da2353a1b5652 /src/libexpr/flake/call-flake.nix
parent532c70f531a0b61eb0ad506497209e302b8250f3 (diff)
flakes: Ensure that `self.outPath == ./.`
Users expect `self` to refer to the directory where the `flake.nix` file resides.
Diffstat (limited to 'src/libexpr/flake/call-flake.nix')
-rw-r--r--src/libexpr/flake/call-flake.nix8
1 files changed, 6 insertions, 2 deletions
diff --git a/src/libexpr/flake/call-flake.nix b/src/libexpr/flake/call-flake.nix
index 8061db3df..7dc03e7f5 100644
--- a/src/libexpr/flake/call-flake.nix
+++ b/src/libexpr/flake/call-flake.nix
@@ -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})