nix icon indicating copy to clipboard operation
nix copied to clipboard

flakes: input is updated on upgrade if repo owner capitalization is changed

Open nmattia opened this issue 1 year ago • 4 comments

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

nmattia avatar May 16 '24 10:05 nmattia

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.

edolstra avatar May 16 '24 13:05 edolstra

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?

nmattia avatar May 16 '24 13:05 nmattia

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

fricklerhandwerk avatar May 22 '24 19:05 fricklerhandwerk

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

nixos-discourse avatar May 22 '24 20:05 nixos-discourse