Workaround for https://github.com/NixOS/nixpkgs/issues/82245
Although this doesn't tackle the root cause of a null package sneaking
in (via executableHaskellDepends), it does effectively treat the symptom
by just ignoring any null packages.
Seeing as that issue has been open for more than a year I think this
band-aid is necessary.
This is necessary when a very large number of packages are included in the
package database. Without this change, setting up the build environment will
fail, since the environment will be too large.
This simply applies the technique mentioned in
https://github.com/NixOS/nixpkgs/issues/25057 to solve this problem.
Previously a few clumsy shell globs were used to find haddock output, which
broke every time something in `generic-builder.nix` changed.
Use the new `haddockDir` identifier exported by haskell packages.
`haskell.packages.ghcjs.ghcWithHoogle` failed because the following line:
for docdir in ${ghc.doc}/${docLibGlob}/*; do
failed because `doc` is not an attribute of `ghc` when `ghc` is
substituted for ghcjs.
Building hoogle environments with an empty list of packages threw a built-time
error. This was particularly confusing when giving e.g. `(hps: [hps.Cabal])`
which, since `Cabal` is set to `null` (because it’s a distribution package),
would have lead to the same error as an empty list.
It was not useful to throw an error at all, because sometimes one only wants to
build an environment for the distribution packages; also the default value for
packages wasn’t even a valid value, so it is removed.
The docs were split at #16167 and broke google support. @peti fixed
build, however hoogle still didn't see packages shipped with GHC. This
patch fixes location of the libraries shipped with GHC.
ghcWithHoogle builds with this patch applied, but it's probably still broken in
the sense that links might point nowhere or that the generated databases and/or
documentation might be incomplete.
* Build most of the stuff on /tmp, not in /nix/store.
* Generate hoogle database for all the dependencies.
* Generate haddock index and contents files.
* Cleanup.