New NUR repo for GHC binaries

I have just pushed a new repo which packages all GHC binaries back to 8.0.1.

> nix-shell -p nur.repos.mpickering.ghc.ghc801
> ghc --version 
The Glorious Glasgow Haskell Compilation System, version 8.0.1

These attributes are intended to facilitate the work flow of using nix and cabal new-build together
where nix is used to provide ghc and cabal but not to manage Haskell dependencies.

It is annoying how quickly the old versions of the compiler get removed from the package set if you use this workflow but now there is an easy way to depend on whatever version of the compiler you want.

The downside to using these attributes is that there are no corresponding package sets. Only the binaries are provided.

The source can be found here

7 Likes

This is fantastic! I was attempting to put the compilers into GitHub - input-output-hk/haskell.nix: Alternative Haskell Infrastructure for Nixpkgs but ran out of time.
I’ll see if I can integrate it today, otherwise it’ll take a bit longer since i’ll be on holidays.

Cool! And this is bindists, not source builds, right? Does it work with darwin? I see some darwin code in the nix expressions but hashes.json only contains linux urls.

Finally, I would recommend against using the name “hash” for the hash parameter. Nix 2.2 added a new feature where output hashes can be specified with a hash name which allows SRI hashes like hash = "sha256-XSLa0FjVyADWWhFfkZ2iKTjFDda6mMXjoYMXLRSYQKQ="; so I think the name hash should only be used to refer to this kind. Introduction - Nix Reference Manual

1 Like

These are prebuilt binaries as I understand it? I would recommend pinning to channels if your ghc version happens to fall on an old release. I have a repo that aggregates the old versions:

This of course leaves some gaps though. ghc-8.4.2, ghc-7.10.1, ghc-7.8.2, ghc-7.8.1 that are missing.

1 Like

The reason that I wanted to package the binaries was so that

  1. There is no chance of having to perform the rebuild from scratch if the cache fails.
  2. There are no gaps between releases.
  3. It is easy to package your own bindist if you want to use an artifact from gitlab for example.
2 Likes

I copied the script which patches the binary from nixpkgs which also supports darwin. I didn’t bother to add darwin support though as I couldn’t test it but it would be possible if someone felt the need to do it.

Thanks for the tip about the “hash” name.