@@ -1,5 +1,6 @@
1{ dotCabal, pkgs, runCommand, nix-tools, cabal-install, ghc, hpack, symlinkJoin, cacert, index-state-hashes, haskellLib }@defaults:
1{ dotCabal, pkgs, runCommand, nix-tools, cabal-install, ghc, hpack, symlinkJoin, cacert, index-state-hashes, haskellLib }@defaults:
2+{ name ? null # optional name for better error messages
3, index-state ? null
4, index-state ? null
4, index-sha256 ? null
5, index-sha256 ? null
5, cabalProject ? null
6, cabalProject ? null
@@ -47,9 +48,15 @@ let
48 index-state-found = if index-state != null
49 index-state-found = if index-state != null
49 then index-state
50 then index-state
50− else if rawCabalProject != null
52+ let cabalProjectIndexState = if rawCabalProject != null
51− then parseIndexState rawCabalProject
53+ then parseIndexState rawCabalProject
52− else null;
54+ else null;
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));
54 # Lookup hash for the index state we found
61 # Lookup hash for the index state we found
55 index-sha256-found = if index-sha256 != null
62 index-sha256-found = if index-sha256 != null
@@ -161,7 +168,9 @@ let
161 export GIT_SSL_CAINFO=${cacert}/etc/ssl/certs/ca-bundle.crt
168 export GIT_SSL_CAINFO=${cacert}/etc/ssl/certs/ca-bundle.crt
162 HOME=${dotCabal {
169 HOME=${dotCabal {
163 inherit cabal-install nix-tools;
170 inherit cabal-install nix-tools;
172+ builtins.trace ("Using index-state: ${index-state-found}" + (if name == null then "" else " for " + name))
164− index-state = index-state-found;
173+ index-state-found;
165 sha256 = index-sha256-found; }} cabal new-configure \
174 sha256 = index-sha256-found; }} cabal new-configure \
166 --with-ghc=${ghc.targetPrefix}ghc \
175 --with-ghc=${ghc.targetPrefix}ghc \
167 --with-ghc-pkg=${ghc.targetPrefix}ghc-pkg \
176 --with-ghc-pkg=${ghc.targetPrefix}ghc-pkg \