Cached Haskell IDE Engine Nix builds for all GHC versions
Go to file
2019-06-20 14:59:08 +02:00
generated Update unstable with stable 2019-06-02 03:51:50 +02:00
nixpkgsForGhc Generate unstable 2019-05-22 23:02:09 +02:00
overrides Remove ghc821 overrides as that GHC version isn't used anymore 2019-06-04 03:27:00 +02:00
src Actually update HIE submodules when checking out the git version.. 2019-06-20 14:59:08 +02:00
.editorconfig Add .editorconfig 2019-06-02 03:49:31 +02:00
.envrc Add .cabal file, proper nix-build 2019-05-06 18:12:26 +02:00
.gitattributes Fix linguist to exclude generated files from the stats 2019-04-12 18:37:57 +02:00
.gitignore gitignore temporary emacs files 2019-06-04 03:25:57 +02:00
all-hies.cabal Add support for multiple HIE versions 2019-05-22 22:46:07 +02:00
check-cache.sh Add 0.10.0.0 paths to cachix checker 2019-06-02 13:29:36 +02:00
default.nix Change Nix file to work with multiple versions 2019-05-22 23:02:06 +02:00
Design.org Update design doc 2019-04-26 16:53:34 +02:00
LICENSE Add license 2019-06-19 18:06:28 +02:00
nixpkgs.nix update.hs: Small improvements; use shell.nix file 2019-04-10 02:54:11 +02:00
Readme.org Clarify that enabling cache isnt the end of it (#14) 2019-06-19 18:12:13 +02:00
shell.nix Add .cabal file, proper nix-build 2019-05-06 18:12:26 +02:00
update.nix updater: Fix initializer bug, simplify caching, simplify file set up 2019-05-11 03:23:11 +02:00

Cached Haskell IDE Engine Nix builds for all GHC versions

This repository provides cached Nix builds for the latest stable Haskell IDE Engine (HIE) for all supported GHC versions. It is intended to be a successor to hie-nix, which only provides a changing subset of versions. This project solves the problem of having mismatched HIE and project GHC versions, which is almost impossible to avoid if you use a globally installed HIE and have many projects.

For unstable versions see this section.

Installation

Cached builds

If you wish to use prebuilt binaries, available on both Linux and macOS, configure the all-hies cache with these instructions, or if you have cachix installed already:

cachix use all-hies

Note: Due to an issue with cachix you might have to restart the nix daemon for this to take effect, refer to this issue.

After configuring the cache, proceed to the install instructions below.

Building without cached builds

On Linux and some versions of macOS, building HIE yourself is also possible and is in fact the default if you don't configure cachix as specified above. The build has a lot of dependencies however, so be prepared to wait a while for it to finish.

The only known macOS version to succeed in building all HIE versions is High Sierra, which was used to build the caches. MacOS Mojave specifically doesn't work for some HIE versions.

NixOS installation

To install stable HIE for a specific set of GHC versions, use the following in your /etc/nixos/configuration.nix. This will install hie and hie-wrapper binaries which are both HIE versions that select the correct version out of the given ones for your projects. Note that hie is just a symlink to hie-wrapper.

  let
    all-hies = import (fetchTarball "https://github.com/infinisil/all-hies/tarball/master") {};
  in
  {
    environment.systemPackages = [
      # Install stable HIE for GHC 8.6.4, 8.6.3 and 8.4.3
      (all-hies.selection { selector = p: { inherit (p) ghc864 ghc863 ghc843; }; })
    ];
  }

To install all stable HIE versions for all supported GHC versions use the following. Warning: Requires ~30GB (or <10GB with compression) of space!

  let
    all-hies = import (fetchTarball "https://github.com/infinisil/all-hies/tarball/master") {};
  in
  {
    environment.systemPackages = [
      # Install all stable HIE versions
      (all-hies.selection { selector = p: p; })
    ];
  }

nix-env installation

To install stable HIE for a specific set of GHC versions use the following. This will install hie and hie-wrapper binaries which are both HIE versions that select the correct version out of the given ones for your projects. Note that hie is just a symlink to hie-wrapper.

  nix-env -iA selection --arg selector 'p: { inherit (p) ghc864 ghc863 ghc843; }' -f https://github.com/infinisil/all-hies/tarball/master

To install all stable HIE versions for all supported GHC versions use the following. Warning: Requires ~30GB (or <10GB with compression) of space!

  nix-env -iA selection --arg selector 'p: p' -f https://github.com/infinisil/all-hies/tarball/master

Unstable versions

Unstable HIE versions are also provided but without build caches, so refer to the section on building without cached builds. These versions are only updated as needed. Note: Currently unstable is the same as stable.

If you just want to get a HIE version for a GHC that stable doesn't support yet, use the unstableFallback attribute, which uses stable if it's available for that GHC version, but falls back to unstable if not. For unstable versions only, use the unstable attribute. Both unstable and unstableFallback provide the selection function just like the standard stable set, so the installation is very similar:

NixOS
let
  all-hies = import (fetchTarball "https://github.com/infinisil/all-hies/tarball/master") {};
in {
  environment.systemPackages = [
    # Install stable HIE for GHC versions 8.6.4 and 8.6.5 if available and fall back to unstable otherwise
    (all-hies.unstableFallback.selection { selector = p: { inherit (p) ghc864 ghc865; }; })

    # Install unstable HIE for GHC versions 8.4.4 and 8.6.5
    (all-hies.unstable.selection { selector = p: { inherit (p) ghc844 ghc865; }; })
  ];
}
nix-env
  # Install stable HIE for GHC versions 8.6.4 and 8.6.5 if available and fall back to unstable otherwise
  nix-env -iA unstableFallback.selection --arg selector 'p: { inherit (p) ghc864 ghc865; }' -f https://github.com/infinisil/all-hies/tarball/master
  
  # Install unstable HIE for GHC versions 8.4.4 and 8.6.5
  nix-env -iA unstable.selection --arg selector 'p: { inherit (p) ghc844 ghc865; }' -f https://github.com/infinisil/all-hies/tarball/master

Updating this repository

This section is only for all-hies developers and not intended for end users.

To have the updater available, run

  alias update="$(nix-build --no-out-link update.nix)/bin/update"

Then you can use it as follows to generate the stable/unstable set (or any other set)

  update --name stable --revision 0.10.0.0
  update --name unstable --revision master

Then to build stable/unstable package sets on high-end machines with 32GB RAM or more, you can use

  nix-build -A versions --max-jobs auto --cores 1
  nix-build -A unstable.versions --max-jobs auto --cores 1

However if you don't have that much RAM, this leads to a lot of thrashing due to the many different dependencies between GHC versions. Use something like the following to prevent this (note that this uses the jq command from the jq package):

  nix-instantiate --eval -E 'builtins.attrNames (import ./. {}).versions' --json | jq -r '.[]' \
    | xargs -I{} -P1 nix-build -A versions.{} --max-jobs auto --cores 1
  nix-instantiate --eval -E 'builtins.attrNames (import ./. {}).unstable.versions' --json | jq -r '.[]' \
    | xargs -I{} -P1 nix-build -A unstable.versions.{} --max-jobs auto --cores 1

Both the update and nix-build's take a long time, but both do a lot of intermediate caching and are idempotent, so they can be interrupted and resumed at any time without losing too much progress. If builds fail for some reason, the overrides directory can be used to add GHC-specific overrides.