Override/configure all haskell packages

Hi all,

I’d like to gain almost ultimate control on Haskell packages, that is to build entire set (or a dependency tree) with specific GHC options, like -O2, -fllvm, use gold linker, etc. I can override specific packages, but need it for all dependencies, dependencies of the dependencies etc.

How would I do that?

You need to override mkDerivation.

For example,

let 
  nixpkgs = import <nixpkgs> {};
  extension = sel: sup: { mkDerivation = drv: sup.mkDerivation (drv // { doHaddock = false; }); };
  hp = nixpkgs.haskellPackages.extend(extension);
in
hp.lens
1 Like

Fantastic! And kind of obvious. Thank you.