[Nix-dev] How to set a specific GHC version?
Alexander Flatter
flatter at fastmail.fm
Fri Aug 7 08:46:28 CEST 2015
Here’s what’s working for me, though I hope there’s a nicer way.
{ pkgs ? (import <nixpkgs> {}) }:
with pkgs;
let
haskellLib = import <nixpkgs/pkgs/development/haskell-modules/lib.nix> { inherit pkgs; };
haskellPackages = with haskellLib; haskell-ng.packages.ghc7101.override {
overrides = (self: super: {
timeout = overrideCabal super.timeout (drv: {
doCheck = false;
patchPhase = ''
sed -i -e 's|base >= 4.5 && < 4.8|base|' neat-interpolation.cabal
'';
});
});
};
myapp = haskellPackages.callPackage ./default.nix { };
devPackages = with haskellPackages; [cabal-install hlint hdevtools];
in
stdenv.lib.overrideDerivation myapp.env (oldAttrs: {
buildInputs = oldAttrs.buildInputs ++ devPackages;
});
> On 07 Aug 2015, at 07:30, Hilco Wijbenga <hilco.wijbenga at gmail.com> 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;
> 2) Now I'm not using haskellngPackages. And we're supposed to migrate
> to that, right?
> _______________________________________________
> nix-dev mailing list
> nix-dev at lists.science.uu.nl
> http://lists.science.uu.nl/mailman/listinfo/nix-dev
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 496 bytes
Desc: Message signed with OpenPGP using GPGMail
Url : http://lists.science.uu.nl/pipermail/nix-dev/attachments/20150807/0077dec1/attachment.bin
More information about the nix-dev
mailing list