NixOS / nix

Nix, the purely functional package manager
https://nixos.org/
GNU Lesser General Public License v2.1
12.6k stars 1.51k forks source link

Hash mismatch on Linux vs MacOS #6837

Open rvolosatovs opened 2 years ago

rvolosatovs commented 2 years ago

Describe the bug

Fetching and unpacking of the same url https://github.com/enarx/linux/archive/refs/tags/v5.19-rc7-enarx-1.tar.gz results in two different hashes on MacOS and Linux (NixOS)

Steps To Reproduce

On NixOS:

$ nix-prefetch-url --unpack https://github.com/enarx/linux/archive/refs/tags/v5.19-rc7-enarx-1.tar.gz
path is '/nix/store/0q7qjvq00d2dnf0qiqrk9lgkla45wha5-v5.19-rc7-enarx-1.tar.gz'
0y2yqimvgmj3y3vjczslw5hcj37pkb9dxkcv3c507vp6y346h292

On MacOS:

$ nix-prefetch-url --unpack https://github.com/enarx/linux/archive/refs/tags/v5.19-rc7-enarx-1.tar.gz
path is '/nix/store/f89i0pqmrzp7l7ay70zm1xjgd4ipaffx-v5.19-rc7-enarx-1.tar.gz'
1alj7xic5dj9bsy9y26pk00fwizwvladny4zlm24rs4hc8fh6p6k

Expected behavior

I'd expect both hashes to match

nix-env --version output

nix-env (Nix) 2.9.1
rvolosatovs commented 2 years ago

cc @platten

chris-martin commented 2 months ago

Maybe the same issue? - I have a flake input

    all-cabal-hashes = {
      type = "github";
      owner = "commercialhaskell";
      repo = "all-cabal-hashes";
      ref = "hackage";
      flake = false;
    };

Linux locked it as

    "all-cabal-hashes": {
      "flake": false,
      "locked": {
        "lastModified": 1722379361,
        "narHash": "sha256-VMUGBZGaiyDrikZh/t2/M7QKekOkK1auPtK2KmnakZ8=",
        "owner": "commercialhaskell",
        "repo": "all-cabal-hashes",
        "rev": "69c9ea6a7746281865968fdccf00a07f5e1bdc04",
        "type": "github"
      },
      "original": {
        "owner": "commercialhaskell",
        "ref": "hackage",
        "repo": "all-cabal-hashes",
        "type": "github"
      }
    },

But my macos-12 and macos-14 builds are failing with

error: NAR hash mismatch in input 'github:commercialhaskell/all-cabal-hashes/69c9ea6a7746281865968fdccf00a07f5e1bdc04' (/nix/store/lqbmmlsbfi3fkgh1a347w9dzyh5gsg68-source), expected 'sha256-VMUGBZGaiyDrikZh/t2/M7QKekOkK1auPtK2KmnakZ8=', got 'sha256-YFS/p3gXpw5hU/3IVwdZ/yDWogb9r3XRYHroZuI8BkI='

All three runners are getting Nix 2.20.5.