From discussion with @andreabedini.
At the moment we do a bunch of parsing of the cabal.project in Nix. This avoids us from having to do more IFD. But we have to do at least one IFD already to get the plan.json. So we could have an analyze-project derivation that gives us the plan.json but also the index-state, repository stanzas etc. That would let us write the logic in Haskell, which would be nicer and easier to test (and could maybe even use the cabal parser).
cc @hamishmack