You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
With Nix 2.35.1, plain nix-build fails in shallow clones with the default flake-compat setup:
… while evaluating the attribute 'revCount'… while calling the '__forceLazyFetcherAttr' builtinerror: '<REPO>' is a shallow Git repository, so 'revCount' is not available
Selecting the package explicitly by nix-build -A default does succeed.
Cause
Lazy revCount nix#15772 made revCount lazy. For a shallow repository, fetching the source succeeds, but explicitly forcing revCount now correctly fails because the full count is unavailable.
flake-compat merges sourceInfo into result, then exposes almost the whole result through defaultNix:
This places the lazy revCount at the top level of defaultNix. The plain nix-build examines every top-level attribute and forces each value to determine whether it is a derivation.
Consequently, bare nix-build forces revCount even when neither the selected package nor the flake outputs use it.
With Nix 2.35.1, plain
nix-buildfails in shallow clones with the default flake-compat setup:Selecting the package explicitly by
nix-build -A defaultdoes succeed.Cause
Lazy revCount nix#15772 made
revCountlazy. For a shallow repository, fetching the source succeeds, but explicitly forcingrevCountnow correctly fails because the full count is unavailable.flake-compatmergessourceInfointoresult, then exposes almost the whole result throughdefaultNix:This places the lazy
revCountat the top level ofdefaultNix. The plainnix-buildexamines every top-level attribute and forces each value to determine whether it is a derivation.Consequently, bare
nix-buildforcesrevCounteven when neither the selected package nor the flake outputs use it.A real-world instance occurred in nix-community/hydra-check#105, after CI began receiving Nix 2.35.1: https://github.com/nix-community/hydra-check/actions/runs/29458017080.
Possible fix / workarounds
One option is to stop exposing the redundant top-level
revCountalias through the legacy build projection:This would still preserve
revCountthrough:self.revCountduring flake output evaluation;(import flake-compat ...).outputs.revCount;defaultNix.sourceInfo.revCount.On a full repository those paths would continue to return the correct count. Downstream projects can currently either:
nix-build -A default, avoiding the top-level scan (which we did); orrevCountcan be computed.