@@ -337,7 +337,7 @@ static FlakeRef applySelfAttrs(
337337static Flake getFlake (
338338 EvalState & state,
339339 const FlakeRef & originalRef,
340- bool useRegistries,
340+ fetchers::UseRegistries useRegistries,
341341 const InputAttrPath & lockRootAttrPath)
342342{
343343 // Fetch a lazy tree first.
@@ -368,7 +368,7 @@ static Flake getFlake(
368368 return readFlake (state, originalRef, resolvedRef, lockedRef, state.storePath (storePath), lockRootAttrPath);
369369}
370370
371- Flake getFlake (EvalState & state, const FlakeRef & originalRef, bool useRegistries)
371+ Flake getFlake (EvalState & state, const FlakeRef & originalRef, fetchers::UseRegistries useRegistries)
372372{
373373 return getFlake (state, originalRef, useRegistries, {});
374374}
@@ -393,8 +393,14 @@ LockedFlake lockFlake(
393393 experimentalFeatureSettings.require (Xp::Flakes);
394394
395395 auto useRegistries = lockFlags.useRegistries .value_or (settings.useRegistries );
396+ auto useRegistriesTop = useRegistries ? fetchers::UseRegistries::All : fetchers::UseRegistries::No;
397+ auto useRegistriesInputs = useRegistries ? fetchers::UseRegistries::Limited : fetchers::UseRegistries::No;
396398
397- auto flake = getFlake (state, topRef, useRegistries, {});
399+ auto flake = getFlake (
400+ state,
401+ topRef,
402+ useRegistriesTop,
403+ {});
398404
399405 if (lockFlags.applyNixConfig ) {
400406 flake.config .apply (settings);
@@ -569,7 +575,11 @@ LockedFlake lockFlake(
569575 if (auto resolvedPath = resolveRelativePath ()) {
570576 return readFlake (state, ref, ref, ref, *resolvedPath, inputAttrPath);
571577 } else {
572- return getFlake (state, ref, useRegistries, inputAttrPath);
578+ return getFlake (
579+ state,
580+ ref,
581+ useRegistriesInputs,
582+ inputAttrPath);
573583 }
574584 };
575585
@@ -717,7 +727,10 @@ LockedFlake lockFlake(
717727 if (auto resolvedPath = resolveRelativePath ()) {
718728 return {*resolvedPath, *input.ref };
719729 } else {
720- auto cachedInput = state.inputCache ->getAccessor (state.store , input.ref ->input , useRegistries);
730+ auto cachedInput = state.inputCache ->getAccessor (
731+ state.store ,
732+ input.ref ->input ,
733+ useRegistriesInputs);
721734
722735 auto lockedRef = FlakeRef (std::move (cachedInput.lockedInput ), input.ref ->subdir );
723736
@@ -834,7 +847,10 @@ LockedFlake lockFlake(
834847 repo, so we should re-read it. FIXME: we could
835848 also just clear the 'rev' field... */
836849 auto prevLockedRef = flake.lockedRef ;
837- flake = getFlake (state, topRef, useRegistries);
850+ flake = getFlake (
851+ state,
852+ topRef,
853+ useRegistriesTop);
838854
839855 if (lockFlags.commitLockFile &&
840856 flake.lockedRef .input .getRev () &&
0 commit comments