[Nix-dev] How to set a specific GHC version?

Mateusz Kowalczyk fuuzetsu at fuuzetsu.co.uk
Fri Aug 7 14:06:56 CEST 2015


On 08/07/2015 06:30 AM, Hilco Wijbenga wrote:
> On 6 August 2015 at 01:30, Eric Sagnes <eric.sagnes at gmail.com> wrote:
>> Have you tried the example from the manual [1]?
>> You can set GHC version by changing the "ghc7101" of the
>> first line to the version name you want.
> 
> I tried similar things but with haskellngPackages but I could not get
> that to work.
> 
> If I change my default.nix to
> 
> { stdenv, haskellngPackages, pkgs }:
> 
> let
>   env = pkgs.haskell.packages.ghc763.ghcWithPackages (p: with p; [
>     cabal-install
>     cabal2nix
>     classy-prelude
>   ]);
> in
>   stdenv.mkDerivation {
>     name        = "project-name";
>     buildInputs = [env];
>     shellHook   = ''
>       export NIX_GHC="${env}/bin/ghc"
>       export NIX_GHCPKG="${env}/bin/ghc-pkg"
>       export NIX_GHC_DOCDIR="${env}/share/doc/ghc/html"
>       export NIX_GHC_LIBDIR=$( $NIX_GHC --print-libdir )
>     '';
>   }
> 
> then Nix is happy but
> 
> 1) GHC 7.6.3 fails to compile;

Why do you specify ‘pkgs.haskell.packages.ghc763’? The official support
is for whatever ‘haskellPackages’ points at which I believe currently is
‘haskell.packages.ghc7101’.

> 2) Now I'm not using haskellngPackages. And we're supposed to migrate
> to that, right?

haskellngPackages right now is just haskellPackages; we are months past
haskellngPackages being made the default so assuming your channel or
whatever is not that old, you're on haskell-ng already. In fact it's
easy to see that you are because you're able to say ‘cabal-install’ and
‘classy-prelude’ which before ng were ‘cabalInstall’ and ‘classyPrelude’.

> _______________________________________________
> nix-dev mailing list
> nix-dev at lists.science.uu.nl
> http://lists.science.uu.nl/mailman/listinfo/nix-dev
> 


-- 
Mateusz K.


More information about the nix-dev mailing list