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

Hilco Wijbenga hilco.wijbenga at gmail.com
Fri Aug 7 07:30:32 CEST 2015


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;
2) Now I'm not using haskellngPackages. And we're supposed to migrate
to that, right?


More information about the nix-dev mailing list