Skip to content
Cached Haskell IDE Engine Nix builds for all GHC versions
Haskell Nix Shell
Branch: master
Clone or download
Infinisil 0.12.0.0 (#18)
0.12.0.0
Latest commit 6b0e851 Aug 12, 2019

Readme.org

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.

You can’t perform that action at this time.