Skip to content
Nix (shell) expression for working on GHC
Branch: master
Clone or download
Latest commit 401ef2a Jun 25, 2019
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
nix Bump nixpkgs Jun 21, 2019
.gitignore A basic .gitignore Mar 31, 2019
LICENSE Initial commit Apr 18, 2018
README.md mention 'cabal update' Feb 20, 2019
default.nix Bump nixpkgs Jun 21, 2019

README.md

Simple usage

Quickstart

To enter an environment without cloning this repository you can run:

nix-shell https://github.com/alpmestan/ghc.nix/archive/master.tar.gz

Building GHC

These commands assume you have cloned this repository to ~/ghc.nix. default.nix has many parameters, all of them optional. You should take a look at default.nix for more details.

$ sed -e '/BuildFlavour = quickest/ s/^#//' mk/build.mk.sample > mk/build.mk
$ nix-shell ~/ghc.nix/ --run './boot && ./configure && make -j4'
# works with --pure too

You can alternatively use Hadrian to build GHC:

$ nix-shell ~/ghc.nix/
# from the nix shell:
$ ./boot && ./configure
# example hadrian command: use 4 cores, build a 'quickest' flavoured GHC
# and place all the build artifacts under ./_mybuild/.
$ hadrian/build.sh -j4 --flavour=quickest --build-root=_mybuild
# you could also ask hadrian to boot and configure for you, with -c

# if you have never used cabal-install on your machine, you will likely
# need to run the following before the hadrian command:
$ cabal update

Running ./validate

$ nix-shell ~/ghc.nix/ --pure --run 'THREADS=4 ./validate'

See other flags of validate by invoking ./validate --help or just by reading its source code. Note that ./validate --slow builds the compiler in debug mode which has the side-effect of disabling performance tests.

Building and running for i686-linux from x86_64-linux

It's trivial!

$ nix-shell ~/ghc.nix/ --arg nixpkgs '(import <nixpkgs> {}).pkgsi686Linux'

TODO

  • We currently can't just invoke nix-build (#1)
  • We do not support all the cross compilation machinery that head.nix from nixpkgs supports.
  • Some tests actually break with GHCs built with the first command above.
You can’t perform that action at this time.