diff options
author | Eelco Dolstra <edolstra@gmail.com> | 2020-04-03 14:06:29 +0200 |
---|---|---|
committer | Eelco Dolstra <edolstra@gmail.com> | 2020-04-03 14:06:29 +0200 |
commit | 6e7f252ea6568d4b151e4a7003cb4cffae26e493 (patch) | |
tree | b85cc3fa2bde9d5be3595f0af1a4fd983f83b580 /src/libexpr/flake/flake.cc | |
parent | 9c78f7f196454228e378d19e4686526214e61bc7 (diff) |
Make --override-input sticky
When we do something like 'nix flake update --override-input nixpkgs
...', the override is now kept on subsequent calls. (If you don't want
this behaviour, you can use --no-write-lock-file.)
Diffstat (limited to 'src/libexpr/flake/flake.cc')
-rw-r--r-- | src/libexpr/flake/flake.cc | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/src/libexpr/flake/flake.cc b/src/libexpr/flake/flake.cc index 313f3bdbd..f23c53a82 100644 --- a/src/libexpr/flake/flake.cc +++ b/src/libexpr/flake/flake.cc @@ -458,8 +458,15 @@ LockedFlake lockFlake( if (input.isFlake) { auto inputFlake = getFlake(state, input.ref, {}, lockFlags.useRegistries, flakeCache); + /* Note: in case of an --override-input, we use + the *original* ref (input2.ref) for the + "original" field, rather than the + override. This ensures that the override isn't + nuked the next time we update the lock + file. That is, overrides are sticky unless you + use --no-write-lock-file. */ auto childNode = std::make_shared<LockedNode>( - inputFlake.lockedRef, inputFlake.originalRef, inputFlake.sourceInfo->info); + inputFlake.lockedRef, input2.ref, inputFlake.sourceInfo->info); node->inputs.insert_or_assign(id, childNode); |