aboutsummaryrefslogtreecommitdiff
path: root/src/libexpr/flake
diff options
context:
space:
mode:
authorAlexander Bantyev <balsoft@balsoft.ru>2021-12-02 11:35:50 +0300
committerAlexander Bantyev <balsoft@balsoft.ru>2021-12-02 12:02:34 +0300
commit8cbf862e6f6e8250d59491fdb88dfc11a805a970 (patch)
tree29a7029ecfd1df6e84acbd9f4b44aa6c40edf85e /src/libexpr/flake
parentf3f32f0c30f197af2fd5a90702f7002ae74b2dfb (diff)
Flakes: computeLocks: pass correct LockParent when reusing oldLock
Previously, when we were attempting to reuse the old lockfile information in the computeLocks function, we have passed the parent of the current input to the next computeLocks call. This was incorrect, since the follows are resolved relative to the parent. This caused issues when we tried to reuse oldLock but couldn't for some reason (read: mustRefetch is true), in that case the follows were resolved incorrectly. Fix this by passing the correct parent, and adding some tests to prevent this particular regression from happening again. Closes https://github.com/NixOS/nix/issues/5697
Diffstat (limited to 'src/libexpr/flake')
-rw-r--r--src/libexpr/flake/flake.cc7
1 files changed, 6 insertions, 1 deletions
diff --git a/src/libexpr/flake/flake.cc b/src/libexpr/flake/flake.cc
index 06136579e..33d253eee 100644
--- a/src/libexpr/flake/flake.cc
+++ b/src/libexpr/flake/flake.cc
@@ -480,11 +480,16 @@ LockedFlake lockFlake(
}
}
+ LockParent newParent {
+ .path = inputPath,
+ .absolute = false
+ };
+
computeLocks(
mustRefetch
? getFlake(state, oldLock->lockedRef, false, flakeCache).inputs
: fakeInputs,
- childNode, inputPath, oldLock, parent, parentPath);
+ childNode, inputPath, oldLock, newParent, parentPath);
} else {
/* We need to create a new lock file entry. So fetch