Skip to content

build: backport fix for shallow clone caches#3388

Merged
ysndr merged 1 commit intomainfrom
build/backport/libfetchers-git-shallow-clone-caching
Jul 18, 2025
Merged

build: backport fix for shallow clone caches#3388
ysndr merged 1 commit intomainfrom
build/backport/libfetchers-git-shallow-clone-caching

Conversation

@ysndr
Copy link
Copy Markdown
Contributor

@ysndr ysndr commented Jul 17, 2025

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

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
@ysndr ysndr requested a review from a team as a code owner July 17, 2025 13:47
@floxbot floxbot added the team-cli Tickets relevant to the flox CLI team label Jul 17, 2025
@ysndr ysndr requested review from a team and tomberek and removed request for a team July 17, 2025 13:47
@ysndr ysndr added this pull request to the merge queue Jul 18, 2025
Merged via the queue into main with commit f043dff Jul 18, 2025
25 checks passed
@ysndr ysndr deleted the build/backport/libfetchers-git-shallow-clone-caching branch July 18, 2025 09:14
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

team-cli Tickets relevant to the flox CLI team

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants