Hoogle DB in Read-Only Nix Store

Following the developer documentation for setting up Haskell, Hoogle gets installed in the read-only Nix store. This isn’t great, since I was hoping to use it for local projects too, and am unable to write to the database. I followed the documentation here:


The error is as follows:

hoogle generate --local=/home/....my_project/
Starting generate
hoogle: /nix/store/lkrvb50ain343jdkl17srmzzvjr0gcbm-hoogle-local-0.1/share/doc/hoogle/default.hoo: openBinaryFile: permission denied (Read-only file system)

I tried it with sudo also, just to be sure. I had a better working configuration before I re-did the install per the manual. :man_facepalming:

Anyone have ideas as to how I can fix this? The install takes several hours and it failed several times before I got the incantation just right.

1 Like

Hi daveman,

What about adding --database=/home/....my_project/default.hoo to the hoogle command line?

Or stack --nix hoogle will do the job. What is taking several hours? Is it Stack building and installing dependencies?



Hoogle should just never get installed into a read-only location on the filesystem, like the Nix store, which happened during a system-wide package installation. Aside from that issue, I eventually did install it project-local, but not every tool knows to look for the Hoogle DB in my local project, as they want to find it at /home/…/.hoogle, which is presumably where it might actually end up on some Linux systems. The solution there was to symlink .hoogle to the project’s stack build directory. I really wish I could explain why sometimes packages get installed super speedy from some binary cache and why sometimes they need to build from source and can take many hours if, for example, it’s an entire Haskell toolchain. It’s almost as if the binary cache search can fail intermittently, triggering the need for a build?