@@ -1,5 +1,6 @@
11{ dotCabal, pkgs, runCommand, nix-tools, cabal-install, ghc, hpack, symlinkJoin, cacert, index-state-hashes, haskellLib }@defaults:
2−{ src
2+{ name ? null # optional name for better error messages
3+, src
34, index-state ? null
45, index-sha256 ? null
56, cabalProject ? null
@@ -47,9 +48,15 @@ let
4748
4849 index-state-found = if index-state != null
4950 then index-state
50− else if rawCabalProject != null
51− then parseIndexState rawCabalProject
52− else null;
51+ else
52+ let cabalProjectIndexState = if rawCabalProject != null
53+ then parseIndexState rawCabalProject
54+ else null;
55+ in
56+ if cabalProjectIndexState != null
57+ then cabalProjectIndexState
58+ else builtins.trace ("Using latest index state" + (if name == null then "" else " for " + name) + "!")
59+ (pkgs.lib.last (builtins.attrNames index-state-hashes));
5360
5461 # Lookup hash for the index state we found
5562 index-sha256-found = if index-sha256 != null
@@ -161,7 +168,9 @@ let
161168 export GIT_SSL_CAINFO=${cacert}/etc/ssl/certs/ca-bundle.crt
162169 HOME=${dotCabal {
163170 inherit cabal-install nix-tools;
164− index-state = index-state-found;
171+ index-state =
172+ builtins.trace ("Using index-state: ${index-state-found}" + (if name == null then "" else " for " + name))
173+ index-state-found;
165174 sha256 = index-sha256-found; }} cabal new-configure \
166175 --with-ghc=${ghc.targetPrefix}ghc \
167176 --with-ghc-pkg=${ghc.targetPrefix}ghc-pkg \