build: backport fix for shallow clone caches#3388
Merged
Conversation
Flox, or more specifically nix expression builds, currently use nix fetchers to fetch shallow git clones of nixpkgs. The git fetcher in Nix < 2.29, was not consistently using the same cache dir for operations on shallow clones, i.e. when computing cache path was determined inconsistently via `getCachePath(<url>, getShallowAttr(input))`, and `getCachePath(<url>, false)`. The most easily observable effect were "fatal" git messages and Nix warnings, as documented in <#3346>. Whether it has further effect on the nixpkgs used, is unclear but possible. The bug was fixed in Nix >= 2.29 via <NixOS/nix#12642>. Since the nix version used here is still 2.28.3, backport the patch until our nixpkgs ships with a patched distribution of nix. Our nixpkgs _do_ include Nix 2.29, but using a pinned Nix, 1. increases the risk of introducing more behavioral changes than including a single few line patch 2. risks us potentially falling behind if we forget to switch back to "stable" nix
tomberek
approved these changes
Jul 17, 2025
dcarley
approved these changes
Jul 18, 2025
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Flox, or more specifically nix expression builds, currently use nix fetchers to fetch shallow git clones of nixpkgs. The git fetcher in Nix < 2.29, was not consistently using the same cache dir for operations on shallow clones, i.e. when computing cache path was determined inconsistently via
getCachePath(<url>, getShallowAttr(input)), andgetCachePath(<url>, false).The most easily observable effect were "fatal" git messages and Nix warnings, as documented in #3346. Whether it has further effect on the nixpkgs used, is unclear but possible.
The bug was fixed in Nix >= 2.29 via
NixOS/nix#12642. Since the nix version used here is still 2.28.3, backport the patch until our nixpkgs ships with a patched distribution of nix.
Our nixpkgs do include Nix 2.29, but using a pinned Nix,