Haskell shell setup with working hoogle - 'developPackage'

Having a working setup for hoogle would be very useful for a large-ish project I’m working on. The flake.nix uses developPackage so just entering a shell allows me to run hoogle server. However, how do I set it up so I can use hoogle on

  • the package I’m working on, and
  • the set of packages I’ve installed locally, and
  • ideally with local links, i.e. no links to hackage?

I’ve tried to work this out through the documentation for hoogle but without success.

This sequence of commands gives me a hoogle on localhost:8080 for the local package:

> cabal haddock --haddock-internal --haddock-quickjump --haddock-hoogle --haddock-html
> hoogle generate --local=./dist-newstyle/build/x86_64-linux/ghc-9.8.2/pkg-0.0.1/doc/html/pkg --database=./local.hoo
> hoogle server --local --database=./local.hoo

but I can’t work out how to include the locally installed packages as well (i.e. the packages by ghc-pkg list, more or less).

Any help or pointers to instructions would be more appreciated.

I found a way of getting an almost working setup for this:

cabal haddock --haddock-internal --haddock-quickjump --haddock-hoogle --haddock-html

hoogle_dir=$(dirname $(dirname $(readlink -f $(which hoogle))))
hoogle generate --database=local.hoo \
       $(for d in $(fd -L .txt ${hoogle_dir}); do printf "--local=%s " $(dirname $d); done) \

hoogle server --local --database=local.foo

The “almost working” part is that links in documentation are working.