Search code examples
haskellcabalnix

Haskell Cabal+Nix: Generate local documentation for all dependencies in a project


How can I generate documentation, possibly with a local hoogle server, with cabal and nix?

I know there is a cabal new-haddock command, but it throws an error:

cabal: renderBuildTargetProblem: unexpected status (TargetDisabledByUser,Nothing)
CallStack (from HasCallStack):
  error, called at ./Distribution/Client/CmdErrorMessages.hs:329:14 in main:Distribution.Client.CmdErrorMessages

And it seems like it is used to build documentation of my project, not of my dependencies anyway.


Solution

  • It turns out all documentation is already there in the /nix/store/. All I needed to do was to generate local documentation with hoogle like so:

    hoogle generate --local --database project.hoo
    

    Then start a server with:

    hoogle server --local -p 8080
    

    And now everything is statically linked. Done!