Cached Haskell IDE Engine Nix builds for all GHC versions
Go to file
2019-10-15 13:41:12 +08:00
generated Update hie bios versions 2019-10-15 13:41:12 +08: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 Prevent User's overlays and config tainting the build 2019-10-14 16:32:36 +08: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.12.0.0 cache paths 2019-08-08 23:39:58 +02:00
default.nix Slightly better formatting for fallback script 2019-07-13 17:44:24 +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 Add temp workaround for hie-bios git revision not being present anymore 2019-10-14 02:05:26 +02:00
shell.nix Add .cabal file, proper nix-build 2019-05-06 18:12:26 +02:00
update.nix Set fixed LOCALE_ARCHIVE in update script 2019-10-13 22:52:37 +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.

Declarative installation (NixOS, home-manager or similar)

This section describes installation with NixOS, but this is easily adaptable to home-manager or other declarative installation methods by using the appropriate file and options. E.g. with home-manager, use ~/.config/nixpkgs/home.nix instead of /etc/nixos/configuration.nix and assign to home.packages instead of environment.systemPackages.

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

Sometimes unstable HIE versions are also provided but without build caches, so refer to the section on building without cached builds. If no unstable version is provided the installation described here will be the same as the stable version.

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

hie-bios versions

There is a HIE PR for using @mpickering's hie-bios. This PR can be built with by using the bios attribute, e.g. all-hies.bios.selection { selector p: { inherit (p) ghc865; }; }.

Due to a git reference having been removed, you need to run this command to get the unbuildable paths from the cache if you don't have the cache enabled by default:

nix-store -r /nix/store/hji603fygfz3a5kkkkzwrf3cfgjpj9d6-haskell-ide-engine-eb3d32e \
  --option substituters https://all-hies.cachix.org \
  --option trusted-public-keys all-hies.cachix.org-1:JjrzAOEUsD9ZMt8fdFbzo3jNAyEWlPAwdVuHw4RD43k=

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
  update --name bios --revision hie-bios --hie-repo https://github.com/mpickering/haskell-ide-engine

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.