ghc.nix icon indicating copy to clipboard operation
ghc.nix copied to clipboard

Missmatch in Cabal Hash

Open lapplislazuli opened this issue 1 year ago • 11 comments

Running:

nix-shell https://github.com/alpmestan/ghc.nix/archive/master.tar.gz --attr devShells.x86_64-darwin.default

I get the following error:

trace: checking if /Users/lapplis/Code/ghc/hadrian/hadrian.cabal is present:  yes
error:
       … while calling the 'derivationStrict' builtin

         at //builtin/derivation.nix:9:12: (source not available)

       … while evaluating derivation 'ghc-shell-for-hadrian-0.1.0.0-0'
         whose name attribute is located at /nix/store/hdbi4byxghl15z8c5sf4kp198ywjphkk-source/pkgs/stdenv/generic/make-derivation.nix:302:7

       … while evaluating attribute 'nativeBuildInputs' of derivation 'ghc-shell-for-hadrian-0.1.0.0-0'

         at /nix/store/hdbi4byxghl15z8c5sf4kp198ywjphkk-source/pkgs/stdenv/generic/make-derivation.nix:342:7:

          341|       depsBuildBuild              = lib.elemAt (lib.elemAt dependencies 0) 0;
          342|       nativeBuildInputs           = lib.elemAt (lib.elemAt dependencies 0) 1;
             |       ^
          343|       depsBuildTarget             = lib.elemAt (lib.elemAt dependencies 0) 2;

       (stack trace truncated; use '--show-trace' to show the full trace)

       error: hash mismatch in file downloaded from 'https://api.github.com/repos/commercialhaskell/all-cabal-hashes/tarball/82e253f8bf75aec8127af50889725d2e611c96c4':
         specified: sha256:156g114qhm93a1vz3nw8v360730ibpkps9bvkyl6bk00c3s8rhgg
         got:       sha256:1235wsvxsbsrs7iwbliyqayk7dy2kdkjx4f7954x1m9gz3152qvf

System:

Macbook Pro 2 GHz Quad-Core Intel Core i5 MacOs Ventura 13.3 (22E252) Nix Version 2.15.0

lapplislazuli avatar Apr 12 '23 09:04 lapplislazuli

Hey @lapplislazuli ,

I've recently removed some (probably) related overrides to increase the environment's creation duration.

Could you please try if the issue exists with on this commit: https://github.com/alpmestan/ghc.nix/commit/f96f57ae48fbbb66ee2f717df0d5c74d45f8066d ?

supersven avatar Apr 14 '23 16:04 supersven

Thanks for the quick answer @supersven.

I sure can try, but ... I must admit I don't know how. I am not too familiar with nix.

What are the commands to build the MacOS version? Running the 'pull online' version still gives the same issue as above.

lapplislazuli avatar Apr 21 '23 06:04 lapplislazuli

Hey, I have the same system (except 2.3 GHz Quad-Core Intel Core i7 and Ventura 13.3.1 (a) and I am having the same issue. I have checked out that commit and the issue still persists:

benjaminbellick@Benjamins-MBP ghc.nix % git status
HEAD detached at f96f57a
nothing to commit, working tree clean
benjaminbellick@Benjamins-MBP ghc.nix % nix-shell shell.nix 
error:
       … while calling the 'derivationStrict' builtin

         at //builtin/derivation.nix:9:12: (source not available)

       … while evaluating derivation 'ghc-shell-for-ghc-buildenv-9.3-0'
         whose name attribute is located at /nix/store/cvgimgg79cm5gr01zahk6i7gvvhgps4p-source/pkgs/stdenv/generic/make-derivation.nix:270:7

       … while evaluating attribute 'nativeBuildInputs' of derivation 'ghc-shell-for-ghc-buildenv-9.3-0'

         at /nix/store/cvgimgg79cm5gr01zahk6i7gvvhgps4p-source/pkgs/stdenv/generic/make-derivation.nix:311:7:

          310|       depsBuildBuild              = lib.elemAt (lib.elemAt dependencies 0) 0;
          311|       nativeBuildInputs           = lib.elemAt (lib.elemAt dependencies 0) 1;
             |       ^
          312|       depsBuildTarget             = lib.elemAt (lib.elemAt dependencies 0) 2;

       (stack trace truncated; use '--show-trace' to show the full trace)

       error: hash mismatch in file downloaded from 'https://api.github.com/repos/commercialhaskell/all-cabal-hashes/tarball/82e253f8bf75aec8127af50889725d2e611c96c4':
         specified: sha256:156g114qhm93a1vz3nw8v360730ibpkps9bvkyl6bk00c3s8rhgg
         got:       sha256:1235wsvxsbsrs7iwbliyqayk7dy2kdkjx4f7954x1m9gz3152qvf

benbellick avatar May 14 '23 00:05 benbellick

FYI, I was able to temporarily fix the issue and enter into a nix.shell by recreating the lock file (this is back on the most recent master commit now):

benjaminbellick@Benjamins-MBP oss % nix flake lock ghc.nix --recreate-lock-file --update-input all-cabal-hashes --extra-experimental-features nix-command --extra-experimental-features flakes
warning: updating lock file '/Users/benjaminbellick/coding/haskell/oss/ghc.nix/flake.lock':
• Updated input 'all-cabal-hashes':
    'github:commercialhaskell/all-cabal-hashes/82e253f8bf75aec8127af50889725d2e611c96c4' (2023-03-18)
  → 'github:commercialhaskell/all-cabal-hashes/e3497dbf7e576ac11e9194ebeeccfca235fd4f21' (2023-05-13)
• Updated input 'nixpkgs':
    'github:nixos/nixpkgs/cd34d6ed7ba7d5c4e44b04a53dc97edb52f2766c' (2023-03-16)
  → 'github:nixos/nixpkgs/9656e85a15a0fe67847ee8cdb99a20d8df499962' (2023-05-12)
• Updated input 'nixpkgs-unstable':
    'github:nixos/nixpkgs/194c2aa446b2b059886bb68be15ef6736d5a8c31' (2023-03-16)
  → 'github:nixos/nixpkgs/635a306fc8ede2e34cb3dd0d6d0a5d49362150ed' (2023-05-11)
• Updated input 'pre-commit-hooks':
    'github:cachix/pre-commit-hooks.nix/32b1dbedfd77892a6e375737ef04d8efba634e9e' (2023-03-16)
  → 'github:cachix/pre-commit-hooks.nix/fb58866e20af98779017134319b5663b8215d912' (2023-04-27)
warning: Git tree '/Users/benjaminbellick/coding/haskell/oss/ghc.nix' is dirty

benbellick avatar May 14 '23 00:05 benbellick

Can you perhaps try checking out the latest commit pushed by the flake lock update action?

MangoIV avatar May 14 '23 07:05 MangoIV

Seems the issue still persists:

benjaminbellick@Benjamins-MBP ghc.nix % git status
On branch update_flake_lock_action
Your branch is up to date with 'origin/update_flake_lock_action'.

nothing to commit, working tree clean
benjaminbellick@Benjamins-MBP ghc.nix % nix develop . --extra-experimental-features nix-command --extra-experimental-features flakes
trace: checking if /hadrian/hadrian.cabal is present:  no
error:
       … while calling the 'derivationStrict' builtin

         at //builtin/derivation.nix:9:12: (source not available)

       … while evaluating derivation 'ghc-shell-for-ghc-buildenv-9.3-0'
         whose name attribute is located at /nix/store/cyqa3d8y0q5dn6mmpyvpr10cz946scqf-source/pkgs/stdenv/generic/make-derivation.nix:303:7

       … while evaluating attribute 'nativeBuildInputs' of derivation 'ghc-shell-for-ghc-buildenv-9.3-0'

         at /nix/store/cyqa3d8y0q5dn6mmpyvpr10cz946scqf-source/pkgs/stdenv/generic/make-derivation.nix:347:7:

          346|       depsBuildBuild              = lib.elemAt (lib.elemAt dependencies 0) 0;
          347|       nativeBuildInputs           = lib.elemAt (lib.elemAt dependencies 0) 1;
             |       ^
          348|       depsBuildTarget             = lib.elemAt (lib.elemAt dependencies 0) 2;

       (stack trace truncated; use '--show-trace' to show the full trace)

       error: NAR hash mismatch in input 'github:commercialhaskell/all-cabal-hashes/e3497dbf7e576ac11e9194ebeeccfca235fd4f21' (/nix/store/3dnhdcsnvg3xl3s7j2znz8blff24c0fb-source), expected 'sha256-BPaS75anHQ0LbRvW6tsfKEs3zTdGQ3AUzoY13eSl4p4=', got 'sha256-3ETGIGjKW+Z80ESfzrRCflDNfJi5a9KSDO/p0+rNtOs='

benbellick avatar May 16 '23 01:05 benbellick

Similar issue from macos

λ ~/m/ghc.nix/ master nix develop
trace: checking if /hadrian/hadrian.cabal is present:  no
error: NAR hash mismatch in input 'github:commercialhaskell/all-cabal-hashes/82e253f8bf75aec8127af50889725d2e611c96c4' (/nix/store/dm3b0dar6k7zpsrqnswvw492yf3mrv4w-source), expected 'sha256-78GM9GAAzGWon3slfeddEYwDzNiI2/F3UCNViEkIz5Q=', got 'sha256-bmNRwvgv1dBJSceRLmebwrczvcI+0sXj0Vkv3bfmZYg='
(use '--show-trace' to show detailed location information)

hw202207 avatar May 17 '23 17:05 hw202207

Tbh this looks like a nix bug (especially if recreating the lock file fixes it)

MangoIV avatar May 17 '23 17:05 MangoIV

This does not get fixed by using the flake update branch, so I guess it's indeed a bug in nix. Can anyone of the mac users report this upstream at nixos/nix? Thanks in advance. Sorry I can't be of help, I don't own a mac

MangoIV avatar May 30 '23 08:05 MangoIV

A workaround for now is running nix flake update locally.

MangoIV avatar May 30 '23 08:05 MangoIV

The workaround works for me. flake.lock got update. Would check in changes to get ride of the problem.

hw202207 avatar May 30 '23 17:05 hw202207