Skip to content

Conversation

@marcin-serwin
Copy link
Contributor

@marcin-serwin marcin-serwin commented Aug 14, 2025

Due to the changes introduced in #349 the hash regex matches the output of pnpm when downloading the https://www.npmjs.com/package/got library. This causes the tool to incorrectly update the hash to the "got" version. To fix this I simply changed the for loop to look for the last regex match in the stderr instead of the first, since the nix hash mismatch message is usually printed last.

Due to the changes introduced in Mic92#349 the hash regex matches the output
of pnpm when downloading the https://www.npmjs.com/package/got library.
This causes the tool to incorrectly update the hash to the "got"
version. To fix this the loop now starts searching from the last line,
since the nix hash mismatch message is usually printed last.

Signed-off-by: Marcin Serwin <[email protected]>
@Mic92 Mic92 force-pushed the push-pvxulwypqxzu branch from d89bcce to dd41903 Compare August 18, 2025 09:29
@SuperSandro2000 SuperSandro2000 requested a review from Mic92 August 21, 2025 23:17
@Mic92 Mic92 merged commit c680bec into Mic92:main Sep 15, 2025
3 checks passed
@OPNA2608
Copy link

OPNA2608 commented Sep 21, 2025

When the output looks like this (nix (Lix, like Nix) 2.94.0-dev):

error: hash mismatch in fixed-output derivation '/nix/store/p0kp6w60lc31q67y4i3hn5mdkh0qkpzf-c680bec003e5f40175ef030a9b90c92cc2acc78a.patch.drv':
           likely URL: https://github.com/Mic92/nix-update/commit/c680bec003e5f40175ef030a9b90c92cc2acc78a.patch
            specified: sha256-AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA=
                  got: sha256-KUG4sPtk/igyava8LYMUjNx0HSuWH9ikGiAObULnAQ4=
        expected path: /nix/store/d0615dmx3mw6gvfd0pww6g57z1ib095f-c680bec003e5f40175ef030a9b90c92cc2acc78a.patch
             got path: /nix/store/wwg4kwld6k7721p5pnywvvr36bssgmji-c680bec003e5f40175ef030a9b90c92cc2acc78a.patch

…then this change causes the hash to get updated to path: /nix/store/wwg4kwld6k7721p5pnywvvr36bssgmji-c680bec003e5f40175ef030a9b90c92cc2acc78a.patch, since that's the last got [...].

@marcin-serwin
Copy link
Contributor Author

I think that at this point it may be better to simply do two substring matches for got: and but got instead of trying to find a common regex for them.

@Mic92
Copy link
Owner

Mic92 commented Sep 21, 2025

When the output looks like this (nix (Lix, like Nix) 2.94.0-dev):

error: hash mismatch in fixed-output derivation '/nix/store/p0kp6w60lc31q67y4i3hn5mdkh0qkpzf-c680bec003e5f40175ef030a9b90c92cc2acc78a.patch.drv':
           likely URL: https://github.com/Mic92/nix-update/commit/c680bec003e5f40175ef030a9b90c92cc2acc78a.patch
            specified: sha256-AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA=
                  got: sha256-KUG4sPtk/igyava8LYMUjNx0HSuWH9ikGiAObULnAQ4=
        expected path: /nix/store/d0615dmx3mw6gvfd0pww6g57z1ib095f-c680bec003e5f40175ef030a9b90c92cc2acc78a.patch
             got path: /nix/store/wwg4kwld6k7721p5pnywvvr36bssgmji-c680bec003e5f40175ef030a9b90c92cc2acc78a.patch

…then this change causes the hash to get updated to path: /nix/store/wwg4kwld6k7721p5pnywvvr36bssgmji-c680bec003e5f40175ef030a9b90c92cc2acc78a.patch, since that's the last got [...].

Mhm. We actually have nix set in the nixpkgs packaging for nix-update, so this must be some sort of overlay. The normal nix-update from nixpkgs should work.

@SuperSandro2000
Copy link
Collaborator

I think the easiest to fix this, is to add nix-update to this list here https://git.lix.systems/lix-project/nixos-module/src/branch/main/overlay.nix#L11-L22

@Mic92
Copy link
Owner

Mic92 commented Sep 22, 2025

If someone wants to patch it, to make it work with Lix again, I would merge it. However long-term I want to switch to json-log-path (available in nix 2.30) that avoids the screenscraping alltogether.

@Mic92
Copy link
Owner

Mic92 commented Sep 22, 2025

#463

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants