[Nix-dev] override a haskellngPackage in shell.nix

Peter Simons simons at cryp.to
Tue Jun 2 11:35:16 CEST 2015


Hi Cody,

here is a "shell.nix" file that does what you want:

 | with (import <nixpkgs> {}).pkgs;
 |
 | let
 |
 |   haskellPackages = haskell.packages.ghc7101.override {
 |     overrides = self: super: {
 |       transformers = self.transformers_0_4_3_0;
 |     };
 |   };
 |
 |   pkg = { mkDerivation, base, stdenv, transformers }:
 |       mkDerivation {
 |         pname = "mtl";
 |         version = "2.2.1";
 |         sha256 = "1icdbj2rshzn0m1zz5wa7v3xvkf6qw811p4s7jgqwvx1ydwrvrfa";
 |         buildDepends = [ base transformers ];
 |         homepage = "http://github.com/ekmett/mtl";
 |         description = "Monad classes, using functional dependencies";
 |         license = stdenv.lib.licenses.bsd3;
 |       };
 |
 |   drv = haskellPackages.callPackage pkg {};
 |
 | in
 |
 |   drv.env

 $ nix-shell --command "ghc-pkg list transformers"
 /nix/store/3pqlvxkj1nsj02gyw3qr0nd9mvs64nvf-ghc-7.10.1/lib/ghc-7.10.1/package.conf.d:
     transformers-0.4.2.0
     transformers-0.4.3.0

Please note that http://wiki.ocharles.org.uk/Nix describes this kind of
setup, too, in the section "Multiple Project Usage".

Best regards,
Peter



More information about the nix-dev mailing list