Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

NIX_GHC_DOCDIR not set properly #76837

Closed
GuillaumeDesforges opened this issue Jan 2, 2020 · 5 comments · Fixed by #76842
Closed

NIX_GHC_DOCDIR not set properly #76837

GuillaumeDesforges opened this issue Jan 2, 2020 · 5 comments · Fixed by #76842
Labels

Comments

@GuillaumeDesforges
Copy link
Contributor

Describe the bug
When creating a Haskell development environment like this:

# shell.nix
{ pkgs ? import <nixpkgs> { } }:

let
  all-hies = import (fetchTarball "https://github.com/infinisil/all-hies/tarball/master") {};
  hie = all-hies.selection { selector = p: { inherit (p) ghc865; }; };

in
  pkgs.haskellPackages.shellFor {
    buildInputs = with pkgs; [
      hie
      cabal-install
    ];

    packages = (hp: with hp; [ gloss ]);
    withHoogle = true;
  }

with withHoogle = true, the doc is generated in ${ghcEnv}/share/doc/hoogle/html, however the NIX_GHC_DOCDIR is set to ${ghcEnv}/share/doc/ghc/html.
The former does not even exist (no such file or directory error on ls $NIX_GHC_DOCDIR).

See this line:

"NIX_${ghcCommandCaps}_DOCDIR" = "${ghcEnv}/share/doc/ghc/html";

Note that I have seen #20730 and think that it is a different issue.

This issue prevents from using HIE in a nix-shell. See https://discourse.nixos.org/t/cant-make-hie-work-on-vs-code-with-nix/5277/

To Reproduce
Use previous shell.nix

nix-shell --run "ls $NIX_GHC_DOCDIR"
nix-shell --run "whateverfolderghcisin/share/doc/hoogle"

Expected behavior
nix-shell --run "ls $NIX_GHC_DOCDIR" should point to ${ghcEnv}/share/doc/hoogle/html

Metadata

% nix run nixpkgs.nix-info -c nix-info -m                                                                                                                                                                                                  ~
 - system: `"x86_64-linux"`
 - host os: `Linux 4.19.91, NixOS, 19.09.1686.69ed29f5f41 (Loris)`
 - multi-user?: `yes`
 - sandbox: `yes`
 - version: `nix-env (Nix) 2.3`
 - channels(arsleust): `"home-manager"`
 - nixpkgs: `/nix/var/nix/profiles/per-user/root/channels/nixos`

Maintainer information:

# a list of nixpkgs attributes affected by the problem
attribute:
# a list of nixos modules affected by the problem
module:
@matthewbauer
Copy link
Member

I think #76842 fixes this.

matthewbauer added a commit to matthewbauer/nixpkgs that referenced this issue Jan 2, 2020
We were previously just installing the "out" output which broke when
we recently changed to generating multiple outputs.

Fixes NixOS#76837
@matthewbauer matthewbauer reopened this Jan 11, 2020
@snawaz
Copy link

snawaz commented May 31, 2020

And while we fix this, I hope we also set another variable HIE_HOOGLE_DATABASE to ${ghcEnv}/share/doc/hoogle/default.hoo (as required by haskell-ide-engine so that it works out of the box without any user settings.

@stale
Copy link

stale bot commented Nov 28, 2020

I marked this as stale due to inactivity. → More info

@stale stale bot added the 2.status: stale https://github.com/NixOS/nixpkgs/blob/master/.github/STALE-BOT.md label Nov 28, 2020
@sternenseemann
Copy link
Member

sternenseemann commented Jan 15, 2023

Is there a need for HIE_HOOGLE_DATABASE or similar today with HLS? cc @maralorn.

@stale stale bot removed the 2.status: stale https://github.com/NixOS/nixpkgs/blob/master/.github/STALE-BOT.md label Jan 15, 2023
@maralorn
Copy link
Member

HLS has no hoogle support, yet.

xanderio pushed a commit to xanderio/nixpkgs that referenced this issue Feb 13, 2023
* Will make it so that GHC.Paths's docdir NIX_GHC_DOCDIR points to an
  actual directory.

* Documentation of all packages in the environment is available in
  `$out/share/doc`.

This has previously been attempted in NixOS#76842 and reverted in NixOS#77442,
since documentation can collide when the libraries wouldn't (thanks to
the hash in the lib filename). `symlinkJoin` allows collision, so this
solution should be akin to NixOS#77523 (minus `buildEnv`, one step at a
time). `installDocumentation = false` restores the old behavior.

Collision in the documentation only happen if the dependency closure of
the given packages has more than one different derivation for the same
library of the very same version. I'm personally inclined not to claim
that our infrastructure does anything sensible in this case.
Additionally, the documentation is likely largely the same in such
cases (unless it is heavily patched).

Resolves NixOS#150666.
Resolves NixOS#76837.
Closes NixOS#150968.
Closes NixOS#77523.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Development

Successfully merging a pull request may close this issue.

6 participants