Tarball Flake resolution differs after 2.91 #841

Open
opened 2025-05-28 07:54:35 +00:00 by getchoo · 2 comments

Describe the bug

Flakes using the Immutable Tarball URL protocol will resolve to different "locked" URLs after Lix 2.91

Steps To Reproduce

  1. Run nix flake metadata https://nixpkgs.dev/channel/nixos-unstable with Lix 2.90
  2. Run it again with Lix >= 2.91
  3. Note the rev query parameter added to the "locked" URL

Expected behavior

Resolution remains consistent across versions

nix --version output

nix (Lix, like Nix) 2.93.0-dev-pre20250502-4e84fd9
System type: x86_64-linux
Additional system types: i686-linux, x86_64-v1-linux, x86_64-v2-linux, x86_64-v3-linux
Features: gc, signed-caches
System configuration file: /etc/nix/nix.conf
User configuration files: /home/seth/.config/nix/nix.conf:/etc/xdg/nix/nix.conf:/guix/current/etc/xdg/nix/nix.conf:/home/seth/.guix-home/profile/etc/xdg/nix/nix.conf:/home/seth/.guix-profile/etc/xdg/nix/nix.conf:/home/seth/.nix-profile/etc/xdg/nix/nix.conf:/nix/profile/etc/xdg/nix/nix.conf:/home/seth/.local/state/nix/profile/etc/xdg/nix/nix.conf:/etc/profiles/per-user/seth/etc/xdg/nix/nix.conf:/nix/var/nix/profiles/default/etc/xdg/nix/nix.conf:/run/current-system/sw/etc/xdg/nix/nix.conf
Store directory: /nix/store
State directory: /nix/var/nix
Data directory: /nix/store/6narfmiim8xxib5la390chspfpa9cv6d-lix-2.93.0-dev-pre20250502-4e84fd9/share

Additional context

It seems Lix is the more technically correct implementation here, as the immutable link header does contain the rev query parameter:

$ curl --silent --location --head https://nixpkgs.dev/channel/nixos-unstable | grep 'rel="immutable"'
link: <https://releases.nixos.org/nixos/unstable/nixos-25.11pre805967.62b852f6c674/nixexprs.tar.xz?rev=62b852f6c6742134ade1abdd2a21685fd617a291>; rel="immutable"

But Lix >= 2.91 is the only implementation of Nix that will resolve Flakes in this way

Comparision

Nix 2.18:

$ nix run github:NixOS/nix/2.18.9 -- flake metadata https://nixpkgs.dev/channel/nixos-unstable
Resolved URL:  https://nixpkgs.dev/channel/nixos-unstable
Locked URL:    https://releases.nixos.org/nixos/unstable/nixos-25.11pre805967.62b852f6c674/nixexprs.tar.xz?narHash=sha256-0VFAX85s2QcFpcNVy7J4yn7j8Cn2IZADd1wsbT%2B1TYs%3D
Description:   A collection of packages for the Nix package manager
Path:          /nix/store/z2yhy2m5xkcwcxlanpgy0wzsy8kwvv90-source
Revision:      62b852f6c6742134ade1abdd2a21685fd617a291
Last modified: 2025-05-26 13:44:23

Nix 2.29:

$ nix run github:NixOS/nix/2.29.0 -- flake metadata https://nixpkgs.dev/channel/nixos-unstable
Resolved URL:  https://nixpkgs.dev/channel/nixos-unstable
Locked URL:    https://releases.nixos.org/nixos/unstable/nixos-25.11pre805967.62b852f6c674/nixexprs.tar.xz?narHash=sha256-0VFAX85s2QcFpcNVy7J4yn7j8Cn2IZADd1wsbT%2B1TYs%3D
Description:   A collection of packages for the Nix package manager
Path:          /nix/store/z2yhy2m5xkcwcxlanpgy0wzsy8kwvv90-source
Revision:      62b852f6c6742134ade1abdd2a21685fd617a291
Last modified: 2025-05-26 13:44:23
Fingerprint:   72b6fe1f4ad2f3284e2843428c658a08053badfb4bdf28793aed22fe63d817c6

Lix 2.90:

$ nix run https://git.lix.systems/lix-project/lix/archive/2.90.0.tar.gz -- flake metadata https://nixpkgs.dev/channel/nixos-unstable
Resolved URL:  https://nixpkgs.dev/channel/nixos-unstable
Locked URL:    https://releases.nixos.org/nixos/unstable/nixos-25.11pre805967.62b852f6c674/nixexprs.tar.xz?narHash=sha256-0VFAX85s2QcFpcNVy7J4yn7j8Cn2IZADd1wsbT%2B1TYs%3D
Description:   A collection of packages for the Nix package manager
Path:          /nix/store/z2yhy2m5xkcwcxlanpgy0wzsy8kwvv90-source
Revision:      62b852f6c6742134ade1abdd2a21685fd617a291
Last modified: 2025-05-26 13:44:23

Lix 2.91:

$ nix run https://git.lix.systems/lix-project/lix/archive/2.91.0.tar.gz -- flake metadata https://nixpkgs.dev/channel/nixos-unstable
Resolved URL:  https://nixpkgs.dev/channel/nixos-unstable
Locked URL:    https://releases.nixos.org/nixos/unstable/nixos-25.11pre805967.62b852f6c674/nixexprs.tar.xz?narHash=sha256-0VFAX85s2QcFpcNVy7J4yn7j8Cn2IZADd1wsbT%2B1TYs%3D&rev=62b852f6c6742134ade1abdd2a21685fd617a291
Description:   A collection of packages for the Nix package manager
Path:          /nix/store/z2yhy2m5xkcwcxlanpgy0wzsy8kwvv90-source
Revision:      62b852f6c6742134ade1abdd2a21685fd617a291
Last modified: 2025-05-26 13:44:23

Lix 2.93:

$ nix run https://git.lix.systems/lix-project/lix/archive/2.93.0.tar.gz -- flake metadata https://nixpkgs.dev/channel/nixos-unstable
Resolved URL:  https://nixpkgs.dev/channel/nixos-unstable
Locked URL:    https://releases.nixos.org/nixos/unstable/nixos-25.11pre805967.62b852f6c674/nixexprs.tar.xz?narHash=sha256-0VFAX85s2QcFpcNVy7J4yn7j8Cn2IZADd1wsbT%2B1TYs%3D&rev=62b852f6c6742134ade1abdd2a21685fd617a291
Description:   A collection of packages for the Nix package manager
Path:          /nix/store/z2yhy2m5xkcwcxlanpgy0wzsy8kwvv90-source
Revision:      62b852f6c6742134ade1abdd2a21685fd617a291
Last modified: 2025-05-26 13:44:23

This results in different flake.locks depending on what implementation/version you're using, which Isn't Great

## Describe the bug Flakes using the Immutable Tarball URL protocol will resolve to different "locked" URLs after Lix 2.91 ## Steps To Reproduce 1. Run `nix flake metadata https://nixpkgs.dev/channel/nixos-unstable` with Lix 2.90 2. Run it again with Lix >= 2.91 3. Note the `rev` query parameter added to the "locked" URL ## Expected behavior Resolution remains consistent across versions ## `nix --version` output ``` nix (Lix, like Nix) 2.93.0-dev-pre20250502-4e84fd9 System type: x86_64-linux Additional system types: i686-linux, x86_64-v1-linux, x86_64-v2-linux, x86_64-v3-linux Features: gc, signed-caches System configuration file: /etc/nix/nix.conf User configuration files: /home/seth/.config/nix/nix.conf:/etc/xdg/nix/nix.conf:/guix/current/etc/xdg/nix/nix.conf:/home/seth/.guix-home/profile/etc/xdg/nix/nix.conf:/home/seth/.guix-profile/etc/xdg/nix/nix.conf:/home/seth/.nix-profile/etc/xdg/nix/nix.conf:/nix/profile/etc/xdg/nix/nix.conf:/home/seth/.local/state/nix/profile/etc/xdg/nix/nix.conf:/etc/profiles/per-user/seth/etc/xdg/nix/nix.conf:/nix/var/nix/profiles/default/etc/xdg/nix/nix.conf:/run/current-system/sw/etc/xdg/nix/nix.conf Store directory: /nix/store State directory: /nix/var/nix Data directory: /nix/store/6narfmiim8xxib5la390chspfpa9cv6d-lix-2.93.0-dev-pre20250502-4e84fd9/share ``` ## Additional context It seems Lix is the more technically correct implementation here, as the immutable `link` header *does* contain the `rev` query parameter: ```console $ curl --silent --location --head https://nixpkgs.dev/channel/nixos-unstable | grep 'rel="immutable"' link: <https://releases.nixos.org/nixos/unstable/nixos-25.11pre805967.62b852f6c674/nixexprs.tar.xz?rev=62b852f6c6742134ade1abdd2a21685fd617a291>; rel="immutable" ``` But Lix >= 2.91 is the only implementation of Nix that will resolve Flakes in this way <details> <summary>Comparision</summary> Nix 2.18: ```console $ nix run github:NixOS/nix/2.18.9 -- flake metadata https://nixpkgs.dev/channel/nixos-unstable Resolved URL: https://nixpkgs.dev/channel/nixos-unstable Locked URL: https://releases.nixos.org/nixos/unstable/nixos-25.11pre805967.62b852f6c674/nixexprs.tar.xz?narHash=sha256-0VFAX85s2QcFpcNVy7J4yn7j8Cn2IZADd1wsbT%2B1TYs%3D Description: A collection of packages for the Nix package manager Path: /nix/store/z2yhy2m5xkcwcxlanpgy0wzsy8kwvv90-source Revision: 62b852f6c6742134ade1abdd2a21685fd617a291 Last modified: 2025-05-26 13:44:23 ``` Nix 2.29: ```console $ nix run github:NixOS/nix/2.29.0 -- flake metadata https://nixpkgs.dev/channel/nixos-unstable Resolved URL: https://nixpkgs.dev/channel/nixos-unstable Locked URL: https://releases.nixos.org/nixos/unstable/nixos-25.11pre805967.62b852f6c674/nixexprs.tar.xz?narHash=sha256-0VFAX85s2QcFpcNVy7J4yn7j8Cn2IZADd1wsbT%2B1TYs%3D Description: A collection of packages for the Nix package manager Path: /nix/store/z2yhy2m5xkcwcxlanpgy0wzsy8kwvv90-source Revision: 62b852f6c6742134ade1abdd2a21685fd617a291 Last modified: 2025-05-26 13:44:23 Fingerprint: 72b6fe1f4ad2f3284e2843428c658a08053badfb4bdf28793aed22fe63d817c6 ``` Lix 2.90: ```console $ nix run https://git.lix.systems/lix-project/lix/archive/2.90.0.tar.gz -- flake metadata https://nixpkgs.dev/channel/nixos-unstable Resolved URL: https://nixpkgs.dev/channel/nixos-unstable Locked URL: https://releases.nixos.org/nixos/unstable/nixos-25.11pre805967.62b852f6c674/nixexprs.tar.xz?narHash=sha256-0VFAX85s2QcFpcNVy7J4yn7j8Cn2IZADd1wsbT%2B1TYs%3D Description: A collection of packages for the Nix package manager Path: /nix/store/z2yhy2m5xkcwcxlanpgy0wzsy8kwvv90-source Revision: 62b852f6c6742134ade1abdd2a21685fd617a291 Last modified: 2025-05-26 13:44:23 ``` Lix 2.91: ```console $ nix run https://git.lix.systems/lix-project/lix/archive/2.91.0.tar.gz -- flake metadata https://nixpkgs.dev/channel/nixos-unstable Resolved URL: https://nixpkgs.dev/channel/nixos-unstable Locked URL: https://releases.nixos.org/nixos/unstable/nixos-25.11pre805967.62b852f6c674/nixexprs.tar.xz?narHash=sha256-0VFAX85s2QcFpcNVy7J4yn7j8Cn2IZADd1wsbT%2B1TYs%3D&rev=62b852f6c6742134ade1abdd2a21685fd617a291 Description: A collection of packages for the Nix package manager Path: /nix/store/z2yhy2m5xkcwcxlanpgy0wzsy8kwvv90-source Revision: 62b852f6c6742134ade1abdd2a21685fd617a291 Last modified: 2025-05-26 13:44:23 ``` Lix 2.93: ```console $ nix run https://git.lix.systems/lix-project/lix/archive/2.93.0.tar.gz -- flake metadata https://nixpkgs.dev/channel/nixos-unstable Resolved URL: https://nixpkgs.dev/channel/nixos-unstable Locked URL: https://releases.nixos.org/nixos/unstable/nixos-25.11pre805967.62b852f6c674/nixexprs.tar.xz?narHash=sha256-0VFAX85s2QcFpcNVy7J4yn7j8Cn2IZADd1wsbT%2B1TYs%3D&rev=62b852f6c6742134ade1abdd2a21685fd617a291 Description: A collection of packages for the Nix package manager Path: /nix/store/z2yhy2m5xkcwcxlanpgy0wzsy8kwvv90-source Revision: 62b852f6c6742134ade1abdd2a21685fd617a291 Last modified: 2025-05-26 13:44:23 ``` </details> This results in different `flake.lock`s depending on what implementation/version you're using, which Isn't Great
Owner

I feel like I've seen this bug before. It's related to work that I think @ma27 or @alois31 were doing, and I don't really think we are likely to fix it?

idk, maybe CppNix should change their behaviour.

I feel like I've seen this bug before. It's related to work that I think @ma27 or @alois31 were doing, and I don't really think we are likely to fix it? idk, maybe CppNix should change their behaviour.
Owner

#520 related?

https://git.lix.systems/lix-project/lix/issues/520 related?
Sign in to join this conversation.
No milestone
No project
No assignees
2 participants
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference: lix-project/lix#841
No description provided.