@@ -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