haskellPackages.shellFor: Work around hoogle generation failure

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 commit is contained in:
Joe Hermaszewski 2021-06-16 10:32:20 +08:00
parent 4327400c1b
commit d8daa7af73
No known key found for this signature in database
GPG key ID: C8116E3A0C1CA76A

View file

@ -63,10 +63,13 @@ buildPackages.stdenv.mkDerivation {
passAsFile = ["buildCommand"];
buildCommand = ''
${lib.optionalString (packages != [] -> docPackages == [])
${let # Filter out nulls here to work around https://github.com/NixOS/nixpkgs/issues/82245
# If we don't then grabbing `p.name` here will fail.
packages' = lib.filter (p: p != null) packages;
in lib.optionalString (packages' != [] -> docPackages == [])
("echo WARNING: localHoogle package list empty, even though"
+ " the following were specified: "
+ lib.concatMapStringsSep ", " (p: p.name) packages)}
+ lib.concatMapStringsSep ", " (p: p.name) packages')}
mkdir -p $out/share/doc/hoogle
echo importing builtin packages