1
0
Fork 0
mirror of https://github.com/NixOS/nix synced 2025-06-25 06:31:14 +02:00

Merge pull request #13330 from NixOS/mergify/bp/2.29-maintenance/pr-13284

lockFlake(): Allow registry lookups for overridden inputs (backport #13284)
This commit is contained in:
mergify[bot] 2025-06-06 08:47:04 +00:00 committed by GitHub
commit 5c3aed3e88
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -570,7 +570,7 @@ LockedFlake lockFlake(
/* Get the input flake, resolve 'path:./...' /* Get the input flake, resolve 'path:./...'
flakerefs relative to the parent flake. */ flakerefs relative to the parent flake. */
auto getInputFlake = [&](const FlakeRef & ref) auto getInputFlake = [&](const FlakeRef & ref, const fetchers::UseRegistries useRegistries)
{ {
if (auto resolvedPath = resolveRelativePath()) { if (auto resolvedPath = resolveRelativePath()) {
return readFlake(state, ref, ref, ref, *resolvedPath, inputAttrPath); return readFlake(state, ref, ref, ref, *resolvedPath, inputAttrPath);
@ -578,7 +578,7 @@ LockedFlake lockFlake(
return getFlake( return getFlake(
state, state,
ref, ref,
useRegistriesInputs, useRegistries,
inputAttrPath); inputAttrPath);
} }
}; };
@ -660,7 +660,7 @@ LockedFlake lockFlake(
} }
if (mustRefetch) { if (mustRefetch) {
auto inputFlake = getInputFlake(oldLock->lockedRef); auto inputFlake = getInputFlake(oldLock->lockedRef, useRegistriesInputs);
nodePaths.emplace(childNode, inputFlake.path.parent()); nodePaths.emplace(childNode, inputFlake.path.parent());
computeLocks(inputFlake.inputs, childNode, inputAttrPath, oldLock, followsPrefix, computeLocks(inputFlake.inputs, childNode, inputAttrPath, oldLock, followsPrefix,
inputFlake.path, false); inputFlake.path, false);
@ -685,10 +685,11 @@ LockedFlake lockFlake(
nuked the next time we update the lock nuked the next time we update the lock
file. That is, overrides are sticky unless you file. That is, overrides are sticky unless you
use --no-write-lock-file. */ use --no-write-lock-file. */
auto ref = (input2.ref && explicitCliOverrides.contains(inputAttrPath)) ? *input2.ref : *input.ref; auto inputIsOverride = explicitCliOverrides.contains(inputAttrPath);
auto ref = (input2.ref && inputIsOverride) ? *input2.ref : *input.ref;
if (input.isFlake) { if (input.isFlake) {
auto inputFlake = getInputFlake(*input.ref); auto inputFlake = getInputFlake(*input.ref, inputIsOverride ? fetchers::UseRegistries::All : useRegistriesInputs);
auto childNode = make_ref<LockedNode>( auto childNode = make_ref<LockedNode>(
inputFlake.lockedRef, inputFlake.lockedRef,