Call for Contributions: We are updating to GHC 9.0.2

We are currently in the process of switching from Stackage LTS 18 to Stackage Nightly again. This will bring the following changes:

  • More up to date versions of Haskell’s most popular packages tracked in Stackage, in particular aeson >= 2.0 which migitates a previously possible DoS attack when operating on untrusted JSON input.
  • GHC 9.0.2 as the default Haskell compiler in nixpkgs, bringing among other things:
    • Linear Types language extension
    • New ghc-bignum Integer backend
    • More lenient haddock interfaces implementation, allowing us to enable doHaddockInterfaces by default, making documentation available in ghci and HLS

Of course, such ecosystem changes are always disruptive - and we’re doing two big changes at once. We can’t do the changes separately anymore, as we pushed the switch to GHC 9.0 back until we felt haskell-language-server was ready and Stackage already switched to aeson 2.0 in the meantime.

@maralon and I spent about 6h on Sunday looking into and fixing regressions, after which we’re left with about 5300 regressions across three platforms compared to before the switch. We’re now looking to fix as many of these remaining build failures as humanly possible before merging the update into nixpkgs master and would like your help!

How to help

The thing we would love some help with is fixing build failures. First of all you’ll need to find some to fix, there’s a couple of good ways to find them:

  • Check out haskell-updates in nixpkgs and try building your favorite haskell packages (or ones you published) and see if they got broken.
  • Browse the failures of the haskell-updates Hydra jobset for failures you are interested in fixing
    • You can browse the plain old failures tab or
    • look at the mergeable and maintained jobset for jobs flagged as particularly important (although these have a person responsible usually)
  • Look at the regularly updated build report which also shows the respective maintainers. If you expand the list in the Unmaintained packages with build failure section you’ll find a list of failing jobs sorted by number of reverse dependencies.

Assuming you found packages you are interested in, here’s how to fix them: Package builds for Haskell are fixed by updating the base package description via a set of haskellPackages overlays located in pkgs/development/haskell-modules/configuration-*.nix. The ones you’ll probably be needing to touch are:

  • configuration-common.nix: for general fixes that are not tied to a specific GHC version or platform and expected to be temporary (i.e. the issue should be fixed upstream as well)
  • configuration-ghc-*.nix: Compiler version specific fixes. Note that we prefer version agnostic fixes, so rather use CPP and introduce a patch in configuration-common.nix than introduce a hard dependency on GHC >= 9.0 in a patch.
  • The other configurations are:
    • configuration-nix.nix: for fixes that are needed because of quirks of Nix/nixpkgs
    • configuration-arm.nix, configuration-darwin.nix: Platform specific workarounds

You can look into these files, especially configuration-common.nix, for inspiration how fixes typically look. The available helper functions are defined at the place of their definition. Typical fixes are:

  • Lifting version constraints on a dependency using the doJailbreak function, e.g. if a package has an unnecessarily strict upper constraint on base (< 4.15).
  • Picking upstream patches using appendPatches.
  • Disabling a broken test suite using dontCheck. Note, though, that we try to make them work whenever possible, so verify that the failure is definitely harmless before disabling a test suite.
  • If you need to inject something into the derivation phases etc. use overrideCabal (over overrideAttrs).

When you’ve found a fix for a package, make sure to add a comment next to your override explaining explaining why it is needed and ideally link an issue or PR that needs to be resolved upstream for us to drop the override (if no issue exist, do open one). All fixes should naturally be PR-ed against the haskell-updates branch.

Helping without touching nixpkgs

If you don’t feel comfortable with the nixpkgs Haskell infrastructure yet, you can still help! Many packages still need to be patched to work with GHC >= 9.0 and aeson >= 2.0. For example, at the time of writing this git-annex doesn’t support aeson >= 2.0. If you find such a failure (as described above), it would be great if you could write a patch making it work, submit it upstream (make sure to check there’s no open PR or fix in the development branch already beforehand!) and let us know in this thread.


Deadline for fixing remaining regressions before they hit the master branch is next tuesday, the 29th of March!


The update has been merged into master: We are now actually using GHC 9.0.2 and Stackage LTS 19! Thanks to all contributors that made this happen, the result of your work should be in channels soon.

This update has not been without regressions due to the significant ecosystem changes that came with it. We’d appreciate bug reports for significant regressions (to you) and contributions fixing them as well!