[Nix-dev] Using hoogle in a haskell development environment on nix

cdep.illabout at gmail.com cdep.illabout at gmail.com
Tue Dec 30 07:08:57 CET 2014


I'm trying to use hoogle in a Haskell development environment exactly
like the one described by O'Charles' wiki:
http://wiki.ocharles.org.uk/Nix

I have modified shell.nix like below in order to use hoogleLocal, but
it doesn't seem to install the hoogle binary for me.

let
  pkgs = import <nixpkgs> {};

  # I'm attempting to use hoogle here, but it is not working.
  haskellPackages =
    let callPackage = pkgs.lib.callPackageWith haskellPackages;
    in pkgs.recurseIntoAttrs (pkgs.haskellPackages.override {
      extension = self: super: {
        thiscurrentpackage = self.callPackage ./. {};
        hoogleLocal = pkgs.haskellPackages.hoogleLocal.override {
          packages = self.thiscurrentpackage;
        };
      };
    });
in pkgs.myEnvFun {
  name = haskellPackages.thiscurrentpackage.name;
  buildInputs = [
    (haskellPackages.ghcWithPackages (hs: ([
      hs.cabalInstall
      hs.ghcMod
      hs.yesodBin
      # This doesn't appear to install the hoogle binary?
      hs.hoogleLocal
    ] ++ hs.thiscurrentpackage.propagatedNativeBuildInputs)))
  ];
}


In the resulting shell, the hoogle binary is not available.

If I include "hs.hoogle" to the buildInputs, the hoogle binary is
installed but it can't find the databases.  Below is what happens when
I try to use it.

$ nix-shell
......
$ hoogle Monad
Could not find some databases: default
Searching in:
  .
    /nix/store/91y9q2y5a2ws8xgcsx1gkhfagc0f2qz6-haskell-hoogle-ghc7.8.3-4.2.36-shared/share/x86_64-linux-ghc-7.8.3/hoogle-4.2.36/databases

    There are no available databases, generate them with: hoogle data
$ hoogle data
    hoogle: /nix/store/91y9q2y5a2ws8xgcsx1gkhfagc0f2qz6-haskell-hoogle-ghc7.8.3-4.2.36-shared/share/x86_64-linux-ghc-7.8.3/hoogle-4.2.36/databases:
changeWorkingDirectory: does not exist (No such file or directory)
$

Anyone know how to get this working correctly for a setup like the
described by O'Charles?


P.S.  This is a marginally related question, but is there some way to
list what packages are available in an environment after running
`nix-shell`?

For instance, I would like to be able to run `nix-shell`, then once
inside the nix-shell I could run something like `nix-env -q` and have
it print out haskellPackages.ghcMod, haskellPackages.cabalInstall,
haskellPackages.yesodBin, haskellPackages.thiscurrentpackage, etc.


More information about the nix-dev mailing list