aboutsummaryrefslogtreecommitdiff
path: root/src/libexpr
diff options
context:
space:
mode:
authorEelco Dolstra <edolstra@gmail.com>2019-05-31 20:12:59 +0200
committerEelco Dolstra <edolstra@gmail.com>2019-05-31 20:12:59 +0200
commit7adb10d29b0041a93d1afeec197bf9af6e8b25b5 (patch)
tree780906be0c6f9c188c032c7e4229cb0eb32dc320 /src/libexpr
parent9169046e64cbffd85a445ebe4313b172a6681646 (diff)
Fix reading the lockfile of a flake in a subdirectory
Diffstat (limited to 'src/libexpr')
-rw-r--r--src/libexpr/primops/flake.cc7
1 files changed, 5 insertions, 2 deletions
diff --git a/src/libexpr/primops/flake.cc b/src/libexpr/primops/flake.cc
index af7d51834..235e10922 100644
--- a/src/libexpr/primops/flake.cc
+++ b/src/libexpr/primops/flake.cc
@@ -482,9 +482,12 @@ ResolvedFlake resolveFlake(EvalState & state, const FlakeRef & topRef, HandleLoc
Flake flake = getFlake(state, topRef, allowedToUseRegistries(handleLockFile, true));
LockFile oldLockFile;
- if (!recreateLockFile (handleLockFile)) {
+ if (!recreateLockFile(handleLockFile)) {
// If recreateLockFile, start with an empty lockfile
- oldLockFile = readLockFile(flake.sourceInfo.storePath + "/flake.lock"); // FIXME: symlink attack
+ // FIXME: symlink attack
+ oldLockFile = readLockFile(
+ state.store->toRealPath(flake.sourceInfo.storePath)
+ + "/" + flake.sourceInfo.resolvedRef.subdir + "/flake.lock");
}
LockFile lockFile(oldLockFile);