[Nix-dev] ghc-mod + nix-shell?
Mateusz Kowalczyk
fuuzetsu at fuuzetsu.co.uk
Wed Aug 20 19:24:05 CEST 2014
On 08/20/2014 05:10 PM, Richard Wallace wrote:
> I've been struggling to get this working. I have ghc-mod installed, but it
> fails to see the packages I have installed when I go into nix-shell. If
> you did get it working, could you post your .nix file somewhere so I (and
> others) can take a look?
>
> Thanks,
> Rich
>
>
I did not get it to fully work as I would have liked but not due to
‘can't see packages’ issue. You'll of course need the changes from [1].
Simply adding ghcMod to build inputs should work. Here is a shell.nix
for a project:
--
let pkgs = import <nixpkgs> {};
myHaskellPackages = pkgs.myHaskellPackages;
haskellPackages = myHaskellPackages.override {
extension = self: super: {
tsuntsun = self.callPackage ./. myHaskellPackages;
};
};
in pkgs.lib.overrideDerivation haskellPackages.tsuntsun (attrs: {
buildInputs = [ pkgs.emacs haskellPackages.cabalInstall
haskellPackages.ghcMod_5_0_1 ] ++ attrs.buildInputs;
})
--
With this after you nix-shell --pure it should work. Seems ghc-mod does
some meddling with cabal so you might have to run cabal configure first.
Both ghc-mod and ghc-modi should work from the shell at this point.
The next problem is that emacs currently hangs. I think it tries to use
ghc-modi and waits for that process to exit but due to the nature of
ghc-modi, it just waits forever. I don't know if it's a problem with the
ELisp shipped with ghc-mod package or the way I wrapped ghc-modi. See my
comment at bottom of [1]. If you can figure out how to proceed from here
then I'd love to hear about it. For now I'm back to just GHCi where I
can and cabal repl where I can't.
[1]: https://github.com/NixOS/nixpkgs/pull/3689
--
Mateusz K.
More information about the nix-dev
mailing list