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.)
This commit is contained in:
parent
9c78f7f196
commit
6e7f252ea6
|
@ -458,8 +458,15 @@ LockedFlake lockFlake(
|
||||||
if (input.isFlake) {
|
if (input.isFlake) {
|
||||||
auto inputFlake = getFlake(state, input.ref, {}, lockFlags.useRegistries, flakeCache);
|
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>(
|
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);
|
node->inputs.insert_or_assign(id, childNode);
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue