flakes: input is updated on upgrade if repo owner capitalization is changed
Describe the bug
I made a change to a flake input that should have no incidence on the build:
- inputs.nixpkgs.url = "github:nixos/nixpkgs";
+ inputs.nixpkgs.url = "github:NixOS/nixpkgs";
However when running a nix upgrade, the input was updated:
$ nix profile upgrade 0
warning: updating lock file 'foo/flake.lock':
• Updated input 'nixpkgs':
'github:nixos/nixpkgs/977a49df312d89b7dfbb3579bf13b7dfe23e7878' (2024-05-16)
→ 'github:NixOS/nixpkgs/4ff362e7100ea0003ec1c7e683f7c6d863fb286b' (2024-05-16)
Expected behavior
I did not expect nix profile upgrade to update inputs
nix-env --version output
nix-env (Nix) 2.18.2
The revision changed as well, right? So upgrading the lock file would be correct behaviour regardless of the change in capitalization.
However, even if there was no new revision, I'm not convinced the change in capitalization shouldn't be reflected in the lock file.
The revision changed as well, right?
The latest revision on that branch had changed, yes; that being said, I did not manually change the revision anywhere.
In general, is it normal for nix profile upgrade to bump the revision?
Triaged in Nix maintainers meeting:
- @tomberek: if the URL changes, regardless how, an update is run. at this point Nix doesn't know that the revision changed, but the subsequent fetch gets you the newest one
- this may be a quirk but not necessarily a bug.
- @roberth: changing the notion of equivalence would have to be per URL scheme
- decision: low priority, may be a good first-time contribution
This issue has been mentioned on NixOS Discourse. There might be relevant details there:
https://discourse.nixos.org/t/2024-05-22-nix-team-meeting-minutes-147/45835/1