NixOS/nixpkgs — pull request #5134 by abbradar (2014-11-26 13:14:37+00:00)
Title: [WIP] Add an option to build externally Haskell libraries bundled with GHC

This is the first approach to the problem, so this is for discussion, not for merge.

This allows one to set `config.haskell.buildCoreLibraries`, which builds updated versions of some libraries bundled with GHC from Hackage. My main interest is to work on my projects with updated `transformers`.

Not all core libraries can be rebuilt as is. `Cabal` package and all things which it depends on (`time`, `filepath` and `deepseq`) cannot be built because we need to somehow bootstrap them (say, build `Setup.hs`'s with builtin `Cabal` version). I don't see this as much of an issue for now (there are no big updates of those packages anyway).

The main problem of this approach is that it is incompatible with `hackage4nix` -- it removes all my changes from libraries. This would increase cost of maintainership, and I don't think this feature outweights the time that would be spent on it. Potential improvements might be:

1) Move these changes to `haskell-packages.nix` in form of overrides.
2) Add support for them to `cabal2nix`.
2a) Detect `ghc` and `doctest` dependencies (pretty much only causes of failures) and disable checking/building with this flag automatically (but then we'd skip testing of packages that can perform partial tests without `doctest` and have according flags).
2b) Add additional options (`doCheckExternal`, `configureFlagsExternal`, `brokenExternal`) and better support for them to remove conditionals like `optional self.buildCoreLibraries`.

I've run a few iterations of builds on Hydra and fixed/disabled all affected packages. The changes are split into many commits to show better what packages are affected and how. There is also a temporary patch for my Hydra to crunch things faster, ignore it.

How can this be improved? Is this of any interest at all? I'm willing to try to make needed changes. Probably better naming of all things added would also be needed (I'm always bad at naming things).

cc @peti , previous discussion at https://github.com/NixOS/nixpkgs/issues/5099 .