-
-
Notifications
You must be signed in to change notification settings - Fork 1.7k
Description
Describe the bug
When using Nix 2.26, nix deems lockfile changes necessary for my Flake, even though they aren't when using Nix 2.25
Steps To Reproduce
- Clone https://github.com/getchoo-contrib/nix-2-26-lock-repro (specifically getchoo-contrib/nix-2-26-lock-repro@a40c1b7)
- Enter a shell with Nix 2.25 via
nix shell github:NixOS/nix/2.25.5 - Run
nix flake archive - Enter a shell with Nix 2.26 via
nix shell github:NixOS/nix/2.26.1 - Run
nix flake archiveagain
Here's how it ran on my machine (plus a few sanity checks for demonstration)
$ git status
HEAD detached at a40c1b7
nothing to commit, working tree clean
$ nix --version
nix (Nix) 2.25.5
$ nix flake archive
$ git status
HEAD detached at a40c1b7
nothing to commit, working tree clean
$ nix shell github:NixOS/nix/2.26.1
$ nix --version
nix (Nix) 2.26.1
$ nix flake archive
warning: updating lock file '"/home/seth/repos/nix-2-26-lock-repro/flake.lock"':
• Updated input 'determinate/determinate-nixd-aarch64-darwin':
'https://install.determinate.systems/determinate-nixd/tag/v0.3.0/macOS?narHash=sha256-yLy38fgeC%2BorxYylwUwLUuRUdgi9WLEflLX9j9NDIUI%3D'
→ 'https://install.determinate.systems/determinate-nixd/tag/v0.3.1/macOS?narHash=sha256-IsrNz0s63v3CZK1Qy3b3309gfiTRugDgRmjuKhwzpp4%3D'
• Updated input 'determinate/determinate-nixd-aarch64-linux':
'https://install.determinate.systems/determinate-nixd/tag/v0.3.0/aarch64-linux?narHash=sha256-9/HjI0v/ZLoTqOy%2B5%2BviIQh8iGjf49qMLRVthVZ3V9U%3D'
→ 'https://install.determinate.systems/determinate-nixd/tag/v0.3.1/aarch64-linux?narHash=sha256-A7vdjMh5GirMmtmV5fha03oV1%2BuFn/sVG6HX7/9Jav0%3D'
• Updated input 'determinate/determinate-nixd-x86_64-linux':
'https://install.determinate.systems/determinate-nixd/tag/v0.3.0/x86_64-linux?narHash=sha256-cyvqGm%2BWT5l3N40wSO6FSJTm7Lxm9w1owpXjAYtGAm4%3D'
→ 'https://install.determinate.systems/determinate-nixd/tag/v0.3.1/x86_64-linux?narHash=sha256-HI3yzhqjRvuG0VXnrDUG3W13ztrDTcQDqHht6SgLcpQ%3D'
$ git status
HEAD detached at a40c1b7
Changes not staged for commit:
(use "git add <file>..." to update what will be committed)
(use "git restore <file>..." to discard changes in working directory)
modified: flake.lock
no changes added to commit (use "git add" and/or "git commit -a")
$ git restore flake.lock
$ exit
$ nix --version
nix (Nix) 2.25.5
$ nix flake archive
$ git status
HEAD detached at a40c1b7
nothing to commit, working tree cleanExpected behavior
Lockfile resolution is consistent across both versions
Metadata
Nix 2.25 version:
$ nix-env --version
nix-env (Nix) 2.25.5
Nix 2.26 version:
$ nix-env --version
nix-env (Nix) 2.26.1
Additional context
This was originally found in https://github.com/getchoo/borealis, where my auto-update workflow ran with Nix 2.26 from https://github.com/DeterminateSystems/nix-installer-action and ended up pushing the change demonstrated above as getchoo/borealis@7cf9edf. I only realized what was going on since (thankfully) I was making other CI changes and I came across inconsistent behavior in subsequent runs
Some other things I noticed while trying to get a good repro for this (that I hope will help!) are:
- The problematic (root) input of https://github.com/DeterminateSystems/determinate recently updated it's
determinate-nixdinputs that are changed as a result of this discrepancy - The
determinate-nixdinputs are not Flakes and useflake = false - The "original" URL of the
determinateinput as recorded inflake.lock(https://flakehub.com/f/DeterminateSystems/determinate/0.1.tar.gz) resolves to the latest version (as intended) with the previously mentioneddeterminate-nixdupdates - Passing
--no-update-lock-filewhen using Nix 2.26 produces it's standard<flake> requires lock file changes but they're not allowed due to '--no-update-lock-file'error message - This issue doesn't happen when pinning the
determinateinput by it's GitHub repository withgithub:DeterminateSystems/determinate/a51f3446e6a798765dd1f47a018717b181938dbc - This issue doesn't happen when pinning the
determinateinput through FlakeHub withhttps://flakehub.com/f/DeterminateSystems/determinate/=0.1.178.tar.gz - This issue doesn't happen in a local checkout of the https://github.com/DeterminateSystems/determinate repository itself
My best guess is that Nix 2.26 may be peaking into (at least some of) the inputs of tarball Flakes through their "original" URL instead of the "resolved" equivalent -- especially since this behavior isn't triggered when you ensure the immutable HTTP URL returned by the former is consistent, like in the last 3 points above
Checklist
- checked latest Nix manual (source)
- checked open bug issues and pull requests for possible duplicates
Add 👍 to issues you find important.