domenkozar / hie-nix

Nix packages for Haskell IDE Engine
115 stars 18 forks source link

Set everything to use specific ghc version #34

Closed freeman42x closed 5 years ago

freeman42x commented 5 years ago

Following the issues encountered in: https://github.com/haskell/haskell-ide-engine/issues/947 Which resulted in having to downgrade everything to ghc822.

How can someone set everything to work with a specific ghc version? In the example above even though I had installed both hies it used the 822 version instead of the 843 version.

freeman42x commented 5 years ago

The fix was to tick under the atom ide haskell plugin settings: use the hie wrapper and use a custom hie wrapper and then specify the path to where hie-wrapper is installed eg. /home/neo/.nix-profile/bin/hie-wrapper

freeman42x commented 5 years ago

Nope. I was wrong, that didn't fix it. That just stopped HIE from starting up. Spinner at the bottom.

develop7 commented 5 years ago

Affects me too, throws the following in the project based on LTS-12.10:

Mismatching GHC versions: Project is 8.4.3, HIE is 8.4.4
You may want to use hie-wrapper. Check the README for more information
domenkozar commented 5 years ago

Yes, that's unfortunate consequence how HIE works. The easiest fixes are:

a) upgrade your project to LTS-12.18 b) downgrade hie-nix to older version

develop7 commented 5 years ago

@domenkozar are you saying hies matching HIE's stack*.yamls cannot be built with nix?

domenkozar commented 5 years ago

It can be, as long as GHC versions match exactly.

develop7 commented 5 years ago

Could you maybe try doing that, as the, um, repository owner? Like, fix derivations to populate and build same hie-x.x.xs as built by upstream's Makefile. My today's attempt to do so ended up at running into https://github.com/input-output-hk/stack2nix/issues/134, let alone this is actually my first attempt to fix nix derivations.

domenkozar commented 5 years ago

@develop7 I'm telling you need to upgrade from LTS-12.10 to LTS-12.18, did you try that?

develop7 commented 5 years ago

@domenkozar thank you for the advice, but no, I did not: because it's a bit less than trivial for the target project and the said project is migrating to nix anyway.

domenkozar commented 5 years ago

In that case you can use https://github.com/domenkozar/hie-nix/commit/96af698f0cfefdb4c3375fc199374856b88978dc which supported GHC 8.4.3

freeman42x commented 5 years ago

@domenkozar I set:

build-depends:       base == 4.11.1.0

which is the base package for ghc 8.4.4

Then I made sure that ghc 8.4.4 was on path. Did a cabal clean, cabal configure just in case. And I am still getting the previous error:

Got error while processing diagnostics: Bad interface file: /nix/store/8dm2vfkhwps5kp9vr9y3f1ppijz5w5bb-ghc-8.4.4/lib/ghc-8.4.4/ghc-prim-0.5.2.0/GHC/Types.hi mismatched interface file versions (wanted "8022", got "8044") Haskell (hie) /home/neo/Projects/CodeWars/

I do have the latest hie installed so I thought it might work following your instructions above for @develop7

freeman42x commented 5 years ago

In the end what worked for me in addition to above steps was to go to ide-haskell-hie settings and set absolute path to hie executable to be: hie-8.4

But ghc-mod is very flaky, types on hover die after the first repl reload.

freeman42x commented 5 years ago

I downgraded to ghc 822 and it works fine. :+1: