on iko/ghcjs-patch-master help sign in
Guard against #884 by checking sha256 (#885)

Not sure what caused #884, but this check should prevent the erroneous output from making it into the binary cache if it happens again.

commita1b6975e57d7d49f79daa7c190d964e86d01a30e authorHamish Mackenzie <Hamish.Mackenzie@iohk.io> dateWed 21 Oct 2020, 21:51 (6 years ago) parentcda15dc
1 file changed+10
mk-local-hackage-repo/default.nix+10
mk-local-hackage-repo/default.nix+10
@@ -24,6 +24,16 @@ export expires="4000-01-01T00:00:00Z"
2424ln -sf ${index} $out/01-index.tar.gz
2525export index_md5=$(nix-hash --flat --type md5 ${index})
2626export index_sha256=$(nix-hash --flat --type sha256 ${index})
27+${
28+ # When possible check the hash we calculate here against the `outputHash`
29+ # of the index derivation (when the `extra-hackages` feature is used the index
30+ # may not have an outputHash).
31+ pkgs.lib.optionalString (index ? outputHash) ''
32+ if [[ "${index.outputHash}" != "$index_sha256" ]]; then
33+ echo "ERROR See https://github.com/input-output-hk/haskell.nix/issues/884"
34+ exit 0
35+ fi
36+''}
2737export index_length=$(stat --printf="%s" ${index})
2838
2939substituteAll ${./root.json} $out/root.json