All Projects → alpmestan → Ghc.nix

alpmestan / Ghc.nix

Licence: bsd-3-clause
Nix (shell) expression for working on GHC

Labels

Projects that are alternatives of or similar to Ghc.nix

Deckdeckgo
The web open source editor for presentations
Stars: ✭ 1,117 (+1088.3%)
Mutual labels:  nix
B
Collection of configuration stuff.
Stars: ✭ 80 (-14.89%)
Mutual labels:  nix
Rules nixpkgs
Rules for importing Nixpkgs packages into Bazel.
Stars: ✭ 88 (-6.38%)
Mutual labels:  nix
Rien
Predictable Haskell development environments with Cabal and Nix.
Stars: ✭ 65 (-30.85%)
Mutual labels:  nix
Terranix
terranix is a terraform.json generator with a nix-like feeling
Stars: ✭ 77 (-18.09%)
Mutual labels:  nix
Cachix Action
Build software only once and put it in a global cache
Stars: ✭ 85 (-9.57%)
Mutual labels:  nix
Neovim Nightly Overlay
[[email protected]]
Stars: ✭ 60 (-36.17%)
Mutual labels:  nix
Nix Processmgmt
Experimental Nix-based process management framework
Stars: ✭ 92 (-2.13%)
Mutual labels:  nix
Nix Tools
Translate Cabals Generic Package Description to a Nix expression
Stars: ✭ 78 (-17.02%)
Mutual labels:  nix
Vuizvui
Nix(OS) expressions used by the OpenLab and its members
Stars: ✭ 87 (-7.45%)
Mutual labels:  nix
Elm2nix
Convert Elm project into Nix expressions
Stars: ✭ 65 (-30.85%)
Mutual labels:  nix
Home Manager Template
A quick-start template for using home-manager in a more reproducible way.
Stars: ✭ 73 (-22.34%)
Mutual labels:  nix
Nixos Configs
My NixOS configs
Stars: ✭ 86 (-8.51%)
Mutual labels:  nix
Dotfiles
well-tailored NixOS & nix-darwin dotfiles
Stars: ✭ 63 (-32.98%)
Mutual labels:  nix
Bauer
An Emacs+Nix IDE
Stars: ✭ 89 (-5.32%)
Mutual labels:  nix
Setup.nix
Nixpkgs based build tools for declarative Python packages [[email protected]]
Stars: ✭ 62 (-34.04%)
Mutual labels:  nix
Dhall Nix
This repository has moved to https://github.com/dhall-lang/dhall-haskell/tree/master/dhall-nix
Stars: ✭ 82 (-12.77%)
Mutual labels:  nix
Pre Commit Hooks.nix
Seamless integration of https://pre-commit.com git hooks with Nix.
Stars: ✭ 92 (-2.13%)
Mutual labels:  nix
Upcast
Abandonware
Stars: ✭ 91 (-3.19%)
Mutual labels:  nix
Homies
linux package management
Stars: ✭ 86 (-8.51%)
Mutual labels:  nix

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.

$ echo "BuildFlavour = quick" > mk/build.mk
$ cat mk/build.mk.sample >> mk/build.mk
$ nix-shell ~/ghc.nix/ --run './boot && ./configure $CONFIGURE_ARGS && make -j4'
# works with --pure too

Note that we passed $CONFIGURE_ARGS to ./configure. While this is technically optional, this argument ensures that configure knows where the compiler's dependencies (e.g. gmp, libnuma, libdw) are found, allowing the compiler to be used even outsite of nix-shell. For convenience, the nix-shell environment also exports a convenience command, configure_ghc, which invokes configure as indicated.

You can alternatively use Hadrian to build GHC:

$ nix-shell ~/ghc.nix/
# from the nix shell:
$ ./boot && ./configure $CONFIGURE_ARGS
# example hadrian command: use 4 cores, build a 'quickest' flavoured GHC
# and place all the build artifacts under ./_mybuild/.
$ hadrian/build -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

Using ghcide

You can also use ghc.nix to provide the right version of ghcide if you want to use ghcide whilst developing on GHC. In order to do so, pass the withIde argument to your nix-shell invocation.

nix-shell ~/.ghc.nix --arg withIde true

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'

Cachix

There is a Cachix cache (ghc-nix) which is filled by our CI. To use it, run the following command and follow the instructions:

cachix use ghc-nix

The cache contains Linux x64 binaries of all packages that are used during a default build (i.e. a build without any overridden arguments).

Updating ghc.nix

We are using niv for dependency management of ghc.nix. Our main external dependencies are nixpkgs and ghcide-nix. To update the revisions of those dependencies, you need to run:

$ niv update

If you want to only update a single dependency, e.g. ghcide, you may run

$ niv update ghcide-nix

If you need to switch the branch of nixpkgs, you need to run niv update nixpkgs -b <branch-name>. As an example, assume you want to use the nightly nixpkgs channel, you run:

$ niv update nixpkgs -b nixos-unstable

After a brief wait time, the revision is updated.

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.
Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].