This was using full `git`, which isn't part of the project `roots`, and so
would often not be cached.
I don't know how this ended up not being problematic before, since this
has been here for a while...
Currently we pass the `--index-state` argument to `cabal` for configuration of a project even if it was found in the `cabal.project` file. This must have seemed harmless enough when we set it up that way, but it causes problems if there are `repository` blocks in the `cabal.project` file.
So for instance if we have a `cabal.project` with:
```
index-state: 2022-01-22T00:00:00Z
index-state: ghcjs-overlay HEAD
repository ghcjs-overlay
url: https://raw.githubusercontent.com/input-output-hk/hackage-overlay-ghcjs/8756b0891a0a550cc8b00dacd24227aee483c0ca
secure: True
root-keys:
key-threshold: 0
```
With the intention of using the `HEAD` version of the `ghcjs-overlay` and letting the commit hash in the `url` ensure it is stable. The first `index-state` is found and `--index-state 2022-01-22T00:00:00Z` is passed on the command line to `cabal`. This overrides the `HEAD` setting for `ghcjs-overlay` and because the timestamps in the `ghcjs-overlay` depend solely on when the `hackage-overlay-repo-tool` ran none of them are included.
The solution is to pass `--index-state` to `cabal` only when it was passed into the project function. When it is not provided `cabal` should still respect the setting in the `cabal.project` file, but it will not elevate it to replace other settings as it does now.
* Improve support for external Hackage repositories
This change builds #535. `repository` blocks in `cabal.project` parsed and `cabal` is used to automatically downloaded them. Then `hackage-to-nix` is used to produce the nix required.
To make it work with restricted eval (on hydra for instance) we need to include a sha256 like this:
```
repository ghcjs-overlay
url: https://input-output-hk.github.io/hackage-overlay-ghcjs
secure: True
root-keys:
key-threshold: 0
--sha256: sha256-EPlLYPmIGtxeahlOspRzwJv+60N5mqrNC2BY4jZKceE=
```
To find the correct `sha256` put in an invalid one and attempt a build.