Still fighting a lot with haskell. I thought nix would be perfect for haskell but I am at a stage where it just make things more complex. My current challenge is to have go to <haskell word under cursor> definition succeed in neovim. My first reflex was to turn to LSP but haskell-ide-engine doesn’t seem ready yet (Go to definition of library methods · Issue #308 · haskell/haskell-ide-engine · GitHub).
My fallback approach (which works great for other languages) is to generate a ctags database readable by neovim. I thus experimented with hasktags/haskdogs but I can’t get it to generate tags for the packages built with the ghc environment (haskdogs on nixos · Issue #4 · grwlf/haskdogs · GitHub). Apparently I need to run cabal update but it complains about the absence of remote servers. I’ve then read about nix-style cabal to no avail.
Thus my question is how do you people achieve “go to definition” for haskell on nixos ?!!!
I tried to program with the doc open in another editor/browser but I can’t take it anymore, “goto” is so much more convenient.
While investigating, the previous problem, I’ve had another one:
from times to times, I have errors about a “./settings” file. I don’t think it comes from my configuration
cabal new-build
cabal:
'/nix/store/zw8v27qx8vz2wridkhfdbbah2sz6633i-ghc-8.4.4-with-packages/bin/ghc'
exited with an error:
./settings: openFile: does not exist (No such file or directory)
when I look at the strace, there seems to be
18953 openat(AT_FDCWD, "./settings", O_RDONLY|O_NOCTTY|O_NONBLOCK) = -1 ENOENT (No such file or directory)
First of all I was able to generate tags for the project at some point \o/
The ./settings: openFile: does not exist (No such file or directory) error still appears though.
I enter the following nix-shell on nixos-unstable. netlink-pm is a pet project I’ve defined in my overlay
with import <nixpkgs> {};
let
hie_remote = builtins.fetchTarball {
url = https://github.com/domenkozar/hie-nix/tarball/master;
};
hie = (import hie_remote {} ).hie84;
in
haskellPackages.shellFor {
packages = p: with p; [ haskellPackages.netlink-pm ];
withHoogle = true;
# haskellPackages.stack
nativeBuildInputs = [
hie
# haskellPackages.cabal-install
];
# export HIE_HOOGLE_DATABASE=$NIX_GHC_DOCDIR as DOCDIR doesn't exist it won't work
shellHook = ''
export HIE_HOOGLE_DATABASE="$NIX_GHC_LIBDIR/../../share/doc/hoogle/index.html"
'';
}
#haskell put me on the list and it’s my fault: I had made changes to haskell’s code to fix a few issues, which I had reverted to exactly rule out this as a problem. Seems like I made a reset --hard on an older commit which brought back my changes and the problem as well. Problem solved. sorry for the noise.