Reduce cabalProject IFD deps using dummy GHCs #607
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
The
cabalProject
function works by runningcabal v2-configure
followed byplan-to-nix
. However forv2-configure
to correctly calculate the plan (including flag settings and buildable components) it needs to know what GHC we want to use.This causes significant problems:
For hydra to assemble a list of jobs from
components.tests
it must first have GHC that will be used. If a patch has been applied to the GHC to be used it must be rebuilt before the list of jobs can be assembled. If a lot of different GHCs are being tests that can be a lot of work all happening in the eval stage where little feedback is available.Once the jobs are running the compilation of the GHC needed (the eval stage already must have done it, but the outputs there are apparently not added to the cache) happens inside the IFD part of
cabalProject
. This causes a very large amount of work to be done in the IFD and our understanding is that this can cause problems on nix and/or hydra.When using
cabalProject
we cannot examine the properties of the project without building or downloading the GHC (less of an issue as we would normally need it soon anyway).The solution here is to:
Create a dummy
ghc
andghc-pkg
from the real ones by capturing theghc
andghc-pkg
outputs thatcabal v2-configure
requests.The dummy
ghc
andghc-pkg
is used instead of the real one incabalProject
when runningcabal v2-configure
.The captured outputs are materialized into the haskell.nix repo so that the real GHC is only needed when
checkMaterialization
is set.