Intero setup
| The following procedure only works when the ghc version of the lts resolver matches the one used for installing Stack. |
Setting up a working Intero/Spacemacs environment is not that easy. The following method does not use a .dev/dev-ghc-env file.
- Install Stack
-
Interorequiresstack. Install itsystem wide(in/etc/nixos/local-configuration.nix)
Current used version is 1.6.5 x86_64 as defined by the nixpkgs stable 18.03 channel.
- Build with Stack
-
$HOME/.dev/stack.yaml
resolver: lts-11.17 nix: enable: true packages: - zlib.dev - gcc - ruby - pkgconfig system-ghc: true skip-ghc-check: trueStack downloads all the haskell libs but it seems to do so in a global user space (?)
stack cleanorremoving $PROJECT/.stack-workwon’t erase them. - Install intero
-
Even if you install
Interoin user space withstack install interoinside a nix shell (nix-shell -p gcc 'haskellPackages.ghcWithPackages(p: with p; [syb ghc-paths mtl network random])') it would not be recognize withinSpacemacs.This is true with
Intero 0.1.32.The only way seems to let
emacsinstallinterothe first time. This will work only ifghc,binutilsandgccare on the$PATH. You will need to add those tolocal-configuration.nix.The installation will work but it won’t find intero because it believe it is in
x86_64-linux-nixfolder that does not exist. The easy fix is to add a symlink:cd $HOME/.stack/compiler-tools; ln -s x86_64-linux x86_64-linux-nix.With stack version < 1.7 you will need to forcefully enable nix in
.stack/config.yaml:nix: enable: trueIf you don’t, intero will try to install
ghcand it will fail.