|
| 1 | +From d0a23238294198f6702e13d117f75af89dbeac62 Mon Sep 17 00:00:00 2001 |
| 2 | +From: Seth Flynn <getchoo@tuta.io> |
| 3 | +Date: Tue, 27 May 2025 22:20:53 -0400 |
| 4 | +Subject: [PATCH] lockFlake(): Allow registry lookups for overridden inputs |
| 5 | + |
| 6 | +Fixes #13144 |
| 7 | +--- |
| 8 | + src/libflake/flake.cc | 11 ++++++----- |
| 9 | + 1 file changed, 6 insertions(+), 5 deletions(-) |
| 10 | + |
| 11 | +diff --git a/src/libflake/flake.cc b/src/libflake/flake.cc |
| 12 | +index fc27df8874e30e7937352445602b3844357e018c..24252d710d7a43f0ef6c789d34e4fcfd206d7e02 100644 |
| 13 | +--- a/src/libflake/flake.cc |
| 14 | ++++ b/src/libflake/flake.cc |
| 15 | +@@ -570,7 +570,7 @@ LockedFlake lockFlake( |
| 16 | + |
| 17 | + /* Get the input flake, resolve 'path:./...' |
| 18 | + flakerefs relative to the parent flake. */ |
| 19 | +- auto getInputFlake = [&](const FlakeRef & ref) |
| 20 | ++ auto getInputFlake = [&](const FlakeRef & ref, const fetchers::UseRegistries useRegistries) |
| 21 | + { |
| 22 | + if (auto resolvedPath = resolveRelativePath()) { |
| 23 | + return readFlake(state, ref, ref, ref, *resolvedPath, inputAttrPath); |
| 24 | +@@ -578,7 +578,7 @@ LockedFlake lockFlake( |
| 25 | + return getFlake( |
| 26 | + state, |
| 27 | + ref, |
| 28 | +- useRegistriesInputs, |
| 29 | ++ useRegistries, |
| 30 | + flakeCache, |
| 31 | + inputAttrPath); |
| 32 | + } |
| 33 | + }; |
| 34 | +@@ -660,7 +660,7 @@ LockedFlake lockFlake( |
| 35 | + } |
| 36 | + |
| 37 | + if (mustRefetch) { |
| 38 | +- auto inputFlake = getInputFlake(oldLock->lockedRef); |
| 39 | ++ auto inputFlake = getInputFlake(oldLock->lockedRef, useRegistriesInputs); |
| 40 | + nodePaths.emplace(childNode, inputFlake.path.parent()); |
| 41 | + computeLocks(inputFlake.inputs, childNode, inputAttrPath, oldLock, followsPrefix, |
| 42 | + inputFlake.path, false); |
| 43 | +@@ -685,10 +685,11 @@ LockedFlake lockFlake( |
| 44 | + nuked the next time we update the lock |
| 45 | + file. That is, overrides are sticky unless you |
| 46 | + use --no-write-lock-file. */ |
| 47 | +- auto ref = (input2.ref && explicitCliOverrides.contains(inputAttrPath)) ? *input2.ref : *input.ref; |
| 48 | ++ auto inputIsOverride = explicitCliOverrides.contains(inputAttrPath); |
| 49 | ++ auto ref = (input2.ref && inputIsOverride) ? *input2.ref : *input.ref; |
| 50 | + |
| 51 | + if (input.isFlake) { |
| 52 | +- auto inputFlake = getInputFlake(*input.ref); |
| 53 | ++ auto inputFlake = getInputFlake(*input.ref, inputIsOverride ? fetchers::UseRegistries::All : useRegistriesInputs); |
| 54 | + |
| 55 | + auto childNode = make_ref<LockedNode>( |
| 56 | + inputFlake.lockedRef, |
0 commit comments