Project revamp (#64)

* Remove update command

Will be replaced with haskell.nix

* Project revamp using haskell.nix

- Only unstable HIE
- Only GHC 8.6.5 and 8.8.3 (or more in the future), but on Linux for both glibc 2.27 (NixOS 19.09) and glibc 2.30 (NixOS 20.03/unstable)
- Using haskell.nix for the builds. This makes evaluation slower, but makes things simpler overall.
- No global installation intended anymore, instead you add HIE to your projects shell.nix file (to be documented in future commits)

Co-authored-by: galagora <45048741+galagora@users.noreply.github.com>

* Remove old files not needed anymore with the revamp

* Add new haskell.nix-generated files

* Add haskell.nix template

* Add nixpkgs infra template

* Build, push and test using GitHub Actions

This builds and pushes all necessary configurations using GitHub Actions
automatically. Also tests the templates

* Update Readme for revamp

* Add template documentation

* Add warning for unsupported versions

* Add haskell.nix + stack template

* Minor Readme changes

* Remove check-cache script

* Don't CI on pushes to haskell.nix

* Use same haskell.nix version for stack/cabal + cleanups

Co-authored-by: galagora <45048741+galagora@users.noreply.github.com>
This commit is contained in:
Silvan Mosberger 2020-07-25 15:25:19 +02:00 committed by GitHub
parent 4b6aab017c
commit b8fb659620
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
91 changed files with 2017 additions and 276801 deletions

View File

@ -1,10 +1,9 @@
root = true
[*.{sh,nix,hs}]
[*]
indent_style = space
indent_size = 2
end_of_line = lf
insert_final_newline = true
trim_trailing_whitespace = true
charset = utf-8

1
.envrc
View File

@ -1 +0,0 @@
use_nix

180
.github/workflows/builds.yaml vendored Normal file
View File

@ -0,0 +1,180 @@
name: CI
on:
push:
branches:
- master
pull_request:
jobs:
materialize-check:
name: Check materialization files for GHC ${{ matrix.ghc }}
runs-on: ubuntu-latest
strategy:
matrix:
ghc: [ "8.6.5", "8.8.3" ]
glibc: [ "2.30" ]
steps:
- uses: actions/checkout@v2
- uses: cachix/install-nix-action@v10
- name: Make sure materializations are up-to-date
run: |
materializationId=$(nix-instantiate --read-write-mode --eval sources.nix -A materializationId | tr -d '"')
if ! diff "$materializationId" "generated/${{ matrix.ghc }}/materialization-id"; then
echo "The materialization files for ${{ matrix.ghc }} are outdated"
echo "Run"
echo " \$(nix-build build.nix -A materialize --argstr ghcVersion ${{ matrix.ghc }} --argstr glibcName glibc-${{ matrix.glibc }})"
echo "to update them"
exit 1
fi
echo "Materialization files up-to-date" >&2
build:
name: HIE Build for ${{ matrix.os }}, GHC ${{ matrix.ghc }}, glibc ${{ matrix.glibc }}
runs-on: ${{ matrix.os }}
needs: materialize-check
strategy:
matrix:
os: [ ubuntu-latest, macos-latest ]
ghc: [ "8.6.5", "8.8.3" ]
glibc: [ "2.30" ]
include:
# Only linux needs matching glibc versions
- os: ubuntu-latest
ghc: "8.6.5"
glibc: "2.27"
- os: ubuntu-latest
ghc: "8.8.3"
glibc: "2.27"
steps:
- uses: actions/checkout@v2
- uses: cachix/install-nix-action@v10
- uses: cachix/cachix-action@09c0620ab018415cbf1e6792e1f415cf892879b5
with:
name: all-hies
extraPullNames: iohk
signingKey: '${{ secrets.CACHIX_SIGNING_KEY }}'
- name: Instantiate HIE
run: |
nix-instantiate build.nix \
-A combined \
--argstr ghcVersion ${{ matrix.ghc }} \
--argstr glibcName glibc-${{ matrix.glibc }} \
--add-root $PWD/drv --indirect
- name: Build HIE
run: |
path=$(nix-store --query --outputs drv)
url=$(sed -E <<< "$path" \
-e 's|-.*|.narinfo|' \
-e 's|/nix/store|https://all-hies.cachix.org|')
code=$(curl -s -o /dev/null -w "%{http_code}\n" "$url")
case "$code" in
200)
echo "Derivation already in cache, not building it"
;;
*)
echo "Derivation not in cache, building it"
# Since we have a lot of derivations to build, do as many of them
# in parallel, but all of them with a single core
nix-store --realise drv --max-jobs auto --cores 1
;;
esac
template_haskell-nix-stack:
name: Haskell.nix stack template for ${{ matrix.os }}
runs-on: ${{ matrix.os }}
needs: build
strategy:
matrix:
os: [ ubuntu-latest, macos-latest ]
defaults:
run:
working-directory: templates/haskell.nix-stack
steps:
- uses: actions/checkout@v2
- uses: cachix/install-nix-action@v10
- uses: cachix/cachix-action@09c0620ab018415cbf1e6792e1f415cf892879b5
with:
name: all-hies
extraPullNames: iohk
- name: Entering nix-shell
run: |
nix-shell --run "echo Successfully entered nix-shell"
- name: Call HIE
run: |
nix-shell --run "hie 2>&1 | tee /dev/stderr | grep 'Main.hs: OK'"
- name: Search hoogle
run: |
nix-shell --run "hoogle fromMaybe | grep Data.Maybe"
- name: Build and run with cabal
run: |
nix-shell --run "stack run"
- name: Build and run with Nix
run: |
nix-build
./result/bin/all-hies-template
template_haskell-nix-cabal:
name: Haskell.nix cabal template for ${{ matrix.os }}
runs-on: ${{ matrix.os }}
needs: build
strategy:
matrix:
os: [ ubuntu-latest, macos-latest ]
defaults:
run:
working-directory: templates/haskell.nix-cabal
steps:
- uses: actions/checkout@v2
- uses: cachix/install-nix-action@v10
- uses: cachix/cachix-action@09c0620ab018415cbf1e6792e1f415cf892879b5
with:
name: all-hies
extraPullNames: iohk
- name: Entering nix-shell
run: |
nix-shell --run "echo Successfully entered nix-shell"
- name: Call HIE
run: |
nix-shell --run "hie 2>&1 | tee /dev/stderr | grep 'Main.hs: OK'"
- name: Search hoogle
run: |
nix-shell --run "hoogle fromMaybe | grep Data.Maybe"
- name: Build and run with cabal
run: |
nix-shell --run "cabal run"
- name: Build and run with Nix
run: |
nix-build
./result/bin/all-hies-template
template_nixpkgs-cabal:
name: Nixpkgs cabal template for ${{ matrix.os }}
runs-on: ${{ matrix.os }}
needs: build
strategy:
matrix:
os: [ ubuntu-latest, macos-latest ]
defaults:
run:
working-directory: templates/nixpkgs-cabal
steps:
- uses: actions/checkout@v2
- uses: cachix/install-nix-action@v10
- uses: cachix/cachix-action@09c0620ab018415cbf1e6792e1f415cf892879b5
with:
name: all-hies
- name: Entering nix-shell
run: |
nix-shell --run "echo Successfully entered nix-shell"
- name: Call HIE
run: |
nix-shell --run "hie 2>&1 | tee /dev/stderr | grep 'Main.hs: OK'"
- name: Search hoogle
run: |
nix-shell --run "hoogle fromMaybe | grep Data.Maybe"
- name: Build and run with cabal
run: |
nix-shell --run "cabal run"
- name: Build and run with Nix
run: |
nix-build
./result/bin/all-hies-template

View File

@ -1,67 +0,0 @@
Assumptions:
- The stack build does not depend on which nixpkgs version it uses, it only needs a matching ghc version
~/.cache/all-hies/ layout:
- haskell-ide-engine: HIE git repository
- nixpkgs: nixpkgs git repository
- history-nixpkgs-unstable: nixpkgs-unstable channel history from https://channels.nix.gsc.io/
- per-ghcMinor: Files for specific minor GHC versions
- <major><minor>: File with the list of base libraries for that ghc version
- per-nixpkgs: Files for specific nixpkgs versions
- ghcVersions: Which GHC versions a nixpkgs version has
- <nixpkgsrev>: List of GHC versions nixpkgs revision <nixpkgsrev> has
- sha256: The sha256 of the nixpkgs version tarball
- <nixpkgsrev>: sha256
- per-hie: Files for specific hie versions
- <hie-rev>: Files for hie version <hie-rev>
- <ghcVersion-stack2nix>.nix: File generated by stack2nix for <hie-rev> and its stack file for <ghcVersion>
./ (repository) layout:
- generated: Files that can be deleted without worry, they'll be regenerated, if possible from the caches in ~/.cache/all-hies
- stack2nix: Files generated by stack2nix
- revision: HIE revision (tag if possible) for the generated files
- <ghcVersion>.nix: stack2nix generated expression for HIE's <ghcVersion> stack file
- nixpkgsHashes
- <nixpkgsrev>: File containing the sha256 hash for nixpkgs version <nixpkgsrev>. This is to allow the Nix builds to download these versions.
- ghcBaseLibraries:
- <ghcVersion>: List of base libraries for that ghc version, used by Nix to set all of those to ~null~. Hack around https://github.com/input-output-hk/stack2nix/issues/134
- nixpkgsForGhc
- <ghcVersion>: File containing the nixpkgs rev to use for that GHC version. This way we can pin nixpkgs versions and don't need to recompile a lot when we change nixpkgs (because we never change a nixpkgs for a ghc version). This is checked in because generating this isn't deterministic.
- overrides:
- <ghcVersion>.nix: Haskell overrides for a specific GHC version, in order to make the build succeed. (Note: So far it doesn't seem that HIE version-specific overrides are needed, because of stack2nix).
Process:
- Update/initialize hie repo
- Update/initialize nixpkgs repo
- Remove ./generated
- Get latest release (latest tag) and revision
- Write tag to ./generated/stack2nix/revision
- Checking out that hie version
- For each stack file for a ghc version
- Find a suitable nixpkgs revision for that ghc version
- If ./nixpkgsForGhc/<ghcVersion> present, use that version
- else
- fetch nixpkgs-unstable history (or use cached version if <15 minutes ago)
- for each channel nixpkgs revision (from newest to oldest)
- Get ghc versions
- If $CACHE/per-nixpkgs/ghcVersions/<revision> exists use that
- Otherwise
- Check out that nixpkgs version
- Run nix evaluation to determine available compilers
- Save result in $CACHE/per-nixpkgs/ghcVersions/<revision>
- If it has the ghc version we need
- Save that revision in ./nixpkgsForGhc/<ghcVersion>
- revision found, exit channel history loop
- Otherwise continue
- If no fitting ghc version was found, log error
- Calculate the sha256 for that nixpkgs version and cache it in $CACHE/per-nixpkgs/sha256/<revision>
- Copy to ./generated/nixpkgsHashes
- Generate the base libraries for that version into ./generated/ghcBaseLibraries
- Check out the revision and run a nix built ghc binary to determine the list
- Cache it into $CACHE/per-nixpkgs/per-ghcMinor/$major$minor
- If ./generated/stack2nix/<ghcVersion> doesn't exist yet
- Checking out that nixpkgs revision
- Invoke stack2nix to generate $CACHE/per-hie/<rev>/<ghcVersion>.nix if it doesn't exist yet
- Copy $CACHE/per-hie/<rev>/<ghcVersion>.nix to ./generated/stack2nix/<ghcVersion>.nix

103
Readme.md Normal file
View File

@ -0,0 +1,103 @@
# Haskell IDE Engine for Nix
This project provides cached Nix builds for [Haskell IDE Engine](https://github.com/haskell/haskell-ide-engine) for GHC 8.6.5 and 8.8.3.
## Installation
Installation is done with your projects nix-shell environment. Both [haskell.nix](https://input-output-hk.github.io/haskell.nix/) and the nixpkgs Haskell infrastructure are supported. If you don't have a nix-shell environment for your project yet, I recommend using haskell.nix.
If you just want to get started, see the [templates](./templates) for fully working example projects.
### haskell.nix Projects
In short, to install HIE for your haskell.nix project, apply the all-hies nixpkgs overlay and add `{ hie = "unstable"; }` to the `tools` argument of [`shellFor`](https://input-output-hk.github.io/haskell.nix/reference/library/#shellfor). If you want to use the prebuilt binaries, use the `all-hies` cachix. Read the rest of this section for more details.
Applying the overlay can be done as follows in a recent haskell.nix version
```nix
let
# Pin all-hies
all-hies = fetchTarball {
# Insert the desired all-hies commit here
url = "https://github.com/infinisil/all-hies/tarball/000000000000000000000000000000000000000";
# Insert the correct hash after the first evaluation
sha256 = "0000000000000000000000000000000000000000000000000000";
};
# Assuming nixpkgs and haskellNix are defined here
# Import nixpkgs with both haskell.nix's overlays and the all-hies one
pkgs = import nixpkgs (haskellNix.nixpkgsArgs // {
overlays = haskellNix.nixpkgsArgs.overlays ++ [
(import all-hies {}).overlay
];
});
/* ... */
in /* ... */
```
Adding HIE to the environment is done like this in your `shellFor` call
```nix
shellFor {
packages = p: [ p.my-package ];
tools = {
hie = "unstable";
};
}
```
Configuring the `all-hies` cachix can be done with [these instructions](https://all-hies.cachix.org/), or if you have cachix installed already:
```shell
$ cachix use all-hies
```
Note that for haskell.nix in general, `cachix use iohk` saves a lot of building time if you use the same nixpkgs as IOHK's CI.
See the [haskell.nix stack template](./templates/haskell.nix-stack) or [haskell.nix cabal template](./templates/haskell.nix-cabal) for a fully working example including a working stack/cabal version and a hoogle database.
### nixpkgs Haskell infrastructure
In short, to install HIE for your project using nixpkgs Haskell infrastructure, apply the all-hies overlay and add the `hie` Haskell package to the `nativeBuildInputs` argument of `shellFor`. If you want to use the prebuilt binaries, use the `all-hies` cachix. Read the rest of this section for more details.
Applying the overlay can be done as follows
```nix
let
# Pin all-hies
all-hies = fetchTarball {
# Insert the desired all-hies commit here
url = "https://github.com/infinisil/all-hies/tarball/000000000000000000000000000000000000000";
# Insert the correct hash after the first evaluation
sha256 = "0000000000000000000000000000000000000000000000000000";
};
# Assuming nixpkgs is defined here
# Import nixpkgs with the all-hies overlay
pkgs = import nixpkgs {
# Pass no config for purity
config = {};
overlays = [
(import all-hies {}).overlay
];
};
/* ... */
in /* ... */
```
Adding HIE to the environment is done like this in your `shellFor` call
```nix
shellFor {
packages = p: [ p.my-package ];
nativeBuildInputs = [
haskellPackages.hie
];
}
```
Configuring the `all-hies` cachix can be done with [these instructions](https://all-hies.cachix.org/), or if you have cachix installed already:
```shell
$ cachix use all-hies
```
See the [nixpkgs infra template](./templates/nixpkgs-cabal) for a fully working example including a working cabal version and a hoogle database.

View File

@ -1,134 +0,0 @@
* Cached Haskell IDE Engine Nix builds for all GHC versions
This repository provides cached Nix builds for the latest stable [[https://github.com/haskell/haskell-ide-engine][Haskell IDE Engine]] (HIE) for all supported GHC versions. It is intended to be a successor to [[https://github.com/domenkozar/hie-nix][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 [[#unstable-versions][this section]].
** Installation
*** Cached builds
If you wish to use prebuilt binaries, available on both Linux and macOS, configure the ~all-hies~ cache with [[https://all-hies.cachix.org/][these instructions]], or if you have cachix installed already:
#+BEGIN_SRC bash
cachix use all-hies
#+END_SRC
Note: Due to an issue with cachix you might have to restart the nix daemon for this to take effect, refer to [[https://github.com/cachix/cachix/issues/188][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 [[https://github.com/rycee/home-manager][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~.
#+BEGIN_SRC nix
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; }; })
];
}
#+END_SRC
To install *all* stable HIE versions for all supported GHC versions use the following. Warning: Requires ~30GB (or <10GB with compression) of space!
#+BEGIN_SRC nix
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; })
];
}
#+END_SRC
*** ~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~.
#+BEGIN_SRC bash
nix-env -iA selection --arg selector 'p: { inherit (p) ghc864 ghc863 ghc843; }' -f https://github.com/infinisil/all-hies/tarball/master
#+END_SRC
To install *all* stable HIE versions for all supported GHC versions use the following. Warning: Requires ~30GB (or <10GB with compression) of space!
#+BEGIN_SRC bash
nix-env -iA selection --arg selector 'p: p' -f https://github.com/infinisil/all-hies/tarball/master
#+END_SRC
*** Unstable versions
Sometimes unstable HIE versions are also provided but *without build caches*, so refer to the section on [[#building-without-cached-builds][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
#+BEGIN_SRC nix
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; }; })
];
}
#+END_SRC
**** ~nix-env~
#+BEGIN_SRC bash
# 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
#+END_SRC
** Updating this repository
This section is only for all-hies developers and not intended for end users.
To have the updater available, run
#+BEGIN_SRC bash
alias update="$(nix-build --no-out-link update.nix)/bin/update"
#+END_SRC
Then you can use it as follows to generate the stable/unstable set (or any other set)
#+BEGIN_SRC bash
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
#+END_SRC
Then to build stable/unstable package sets on high-end machines with 32GB RAM or more, you can use
#+BEGIN_SRC bash
nix-build -A versions --max-jobs auto --cores 1
nix-build -A unstable.versions --max-jobs auto --cores 1
#+END_SRC
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):
#+BEGIN_SRC bash
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
#+END_SRC
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.

View File

@ -1,28 +0,0 @@
cabal-version: 2.4
name: all-hies
version: 0.1.0.0
author: Silvan Mosberger
maintainer: infinisil@icloud.com
executable update
hs-source-dirs: src
main-is: Main.hs
other-modules: Cache
Options
build-depends: base ^>=4.12.0.0
, haskeline
, process
, regex-applicative
, directory
, filepath
, stack2nix
, http-client
, http-client-tls
, time
, aeson
, mtl
, bytestring
, Cabal
, temporary
, optparse-applicative
default-language: Haskell2010

68
build.nix Normal file
View File

@ -0,0 +1,68 @@
{ ghcVersion, glibcName }:
let
sources = import ./sources.nix;
pkgs = sources.glibcSpecificPkgs.${glibcName};
inherit (pkgs) lib;
versionList = builtins.match "([0-9]+)\\.([0-9]+)\\.([0-9]+)" ghcVersion;
version = rec {
major = lib.elemAt versionList 0;
minor = lib.elemAt versionList 1;
patch = lib.elemAt versionList 2;
dotVersion = "${major}.${minor}.${patch}";
tightVersion = "${major}${minor}${patch}";
};
supportedVersions = [ "8.6.5" "8.8.3" ];
unsupportedWarning = if lib.elem ghcVersion supportedVersions then lib.id else lib.warn "all-hies: GHC version ${ghcVersion} is not supported, no caches are available and the build will probably fail";
stackArgs = {
src = sources.hie.src;
stackYaml = "stack-${version.dotVersion}.yaml";
# TODO: Remove GHC from closure
modules = [{
reinstallableLibGhc = true;
doHaddock = false;
packages.ghc.flags.ghci = true;
packages.ghci.flags.ghci = true;
packages.haskell-ide-engine.configureFlags = [ "--enable-executable-dynamic" ];
}];
};
generatedDir = ./generated + "/${version.dotVersion}";
hashFile = generatedDir + "/stack-sha256";
materializedDir = generatedDir + "/materialized";
materializedStackArgs = stackArgs // lib.optionalAttrs (builtins.pathExists generatedDir) {
stack-sha256 = lib.fileContents hashFile;
materialized = materializedDir;
};
combined =
let
haskellSet = pkgs.haskell-nix.stackProject materializedStackArgs;
inherit (haskellSet.haskell-ide-engine.components.exes) hie;
inherit (haskellSet.hie-bios.components.exes) hie-bios;
in (pkgs.buildEnv {
name = "haskell-ide-engine-${version.dotVersion}-${sources.hie.version}";
paths = [ hie hie-bios ];
pathsToLink = [ "/bin" ];
inherit (hie) meta;
}).overrideAttrs (old: {
allowSubstitutes = true;
});
materialize =
let
haskellSet = pkgs.haskell-nix.stackProject stackArgs;
in pkgs.writeShellScript "materialize-${version.dotVersion}" ''
set -x
mkdir -p ${toString generatedDir}
nix-hash --base32 --type sha256 ${haskellSet.stack-nix} > ${toString hashFile}
${pkgs.coreutils}/bin/cp -r --no-preserve=mode -T ${haskellSet.stack-nix} ${toString materializedDir}
cp ${sources.materializationId} ${toString generatedDir}/materialization-id
'';
in unsupportedWarning {
inherit combined materialize;
}

View File

@ -1,205 +0,0 @@
#!/usr/bin/env bash
# This script is here for both future reference on how to check that a cache
# serves a path, and to make sure cachix's 10GB limit doesn't mean it deletes
# paths still needed.
# In addition, you could use these paths here to fetch the derivations directly,
# completely circumventing the slow Nix evaluation, at the cost of
# reproducibility. Only seems useful for one-off testing or so.
storepaths=(
# 1.1
## x86_64-linux
/nix/store/dgs02431fz60zkmkvpx8grbb2i4ahd3c-haskell-ide-engine-ghc842-1.1
/nix/store/5qvfgjzyxly990l7skzgbf3c8qix8073-haskell-ide-engine-ghc843-1.1
/nix/store/6hhh5aiyxijz6ym3yck1d04i1lx49rnr-haskell-ide-engine-ghc844-1.1
/nix/store/nzn6pzq5r58v25y9pb8b9jrqh9p02z43-haskell-ide-engine-ghc864-1.1
/nix/store/qwrwp6zrmw2slvfqzx5dl4wziq8jcjgh-haskell-ide-engine-ghc865-1.1
/nix/store/z3ibpz4qhyz62cka5pncv1dff3vv353n-haskell-ide-engine-ghc881-1.1
/nix/store/n1gibsl3c6jpd46i5016l31ac68m1rq9-haskell-ide-engine-ghc882-1.1
## x86_64-darwin
/nix/store/z09kdrng69gx0n6644l3y1173901sdmp-haskell-ide-engine-ghc842-1.1
/nix/store/5ygzlmn3hzih5ml336d0bhy23ffyczzk-haskell-ide-engine-ghc843-1.1
/nix/store/rb14ylqqmiy0mhl59pp6cc6vql6ipk3j-haskell-ide-engine-ghc844-1.1
/nix/store/hayssh03rw586d4clk0xs0w7i3klk2x5-haskell-ide-engine-ghc864-1.1
/nix/store/d6kmba464kac15yn9qys0s66r9fns7mq-haskell-ide-engine-ghc865-1.1
/nix/store/ks0vn6a7161qqjfgcv1c3hm0a0dnvfac-haskell-ide-engine-ghc881-1.1
/nix/store/nrhyw66d132bpfm5lhks0hiw8djbkr5a-haskell-ide-engine-ghc882-1.1
# 1.0.0.0
## x86_64-linux
/nix/store/sk086bkr8f4yjg0715c8k9lx907r9j5h-haskell-ide-engine-ghc842-1.0.0.0
/nix/store/shvam04y1xxma6vs3scx8rvxy3nab0jj-haskell-ide-engine-ghc843-1.0.0.0
/nix/store/sdzx9hbslsdk0z5k21x7259v6mihx07h-haskell-ide-engine-ghc844-1.0.0.0
/nix/store/jcqafgk3h8h60hv4z3x7kp5fyh2h90vb-haskell-ide-engine-ghc861-1.0.0.0
/nix/store/ihfvldzicc05g7mdx9y4jix6wxldcyb3-haskell-ide-engine-ghc862-1.0.0.0
/nix/store/ik2sn2bqgn0wh2k1sgi92ag3dmbshawd-haskell-ide-engine-ghc863-1.0.0.0
/nix/store/b6hjjms6lzfpnwqiflaqa29pf971ii5q-haskell-ide-engine-ghc864-1.0.0.0
/nix/store/gbyjamvg0vz00izjl9cddgynpz34g13d-haskell-ide-engine-ghc865-1.0.0.0
## x86_64-darwin
/nix/store/hs35i7a8akw92s33535pn7s9ll03h92m-haskell-ide-engine-ghc842-1.0.0.0
/nix/store/kr44by4jhhmsjgdzzlgvsb1pm4b3pi53-haskell-ide-engine-ghc843-1.0.0.0
/nix/store/xr80fkvi9a6d1kcz15z9193909d5z45f-haskell-ide-engine-ghc844-1.0.0.0
/nix/store/0lmy07adcb22gy63cwllrr1hbwxmpz1j-haskell-ide-engine-ghc861-1.0.0.0
/nix/store/vrj0l16jg5x8l7scphzpw74845ync6b7-haskell-ide-engine-ghc862-1.0.0.0
/nix/store/l7g6f9facx5k0sdfwiqzaqd9s9y5jqsg-haskell-ide-engine-ghc863-1.0.0.0
/nix/store/0z54skjwfd5malhf9d3m83ksx6wq5kvb-haskell-ide-engine-ghc864-1.0.0.0
/nix/store/k8i38lkf56y0zj423g96132b2c2md9dr-haskell-ide-engine-ghc865-1.0.0.0
# 0.14.0.0
## x86_64-linux
/nix/store/fv5g10aimim5dpiczm2lfihaag02vhxl-haskell-ide-engine-ghc842-0.14.0.0
/nix/store/jsqg0bzzwwhhvdmqmp7i4w8lgb3m16d4-haskell-ide-engine-ghc843-0.14.0.0
/nix/store/k6xpscrdj6mljxs0lfc7z53h02d2pssy-haskell-ide-engine-ghc844-0.14.0.0
/nix/store/ghkyvmv9hii7j0mxrhw65k1rf8714zjv-haskell-ide-engine-ghc861-0.14.0.0
/nix/store/6jdnw7nmh70qdn68pkxribbqfx3hgb29-haskell-ide-engine-ghc862-0.14.0.0
/nix/store/yfdwlzwvgz9mw6ahyfi9kzy73bfw28wg-haskell-ide-engine-ghc863-0.14.0.0
/nix/store/k719sij8skn4r8l128hqg324gpw13bsv-haskell-ide-engine-ghc864-0.14.0.0
/nix/store/6wsy89l4jnsy4qp4ywsyg572ily295zl-haskell-ide-engine-ghc865-0.14.0.0
## x86_64-darwin
/nix/store/96swblwrifddpri0pphq60l3wmw5glx3-haskell-ide-engine-ghc842-0.14.0.0
/nix/store/vjn9z839m1qgs1hx25w1m19mqarcrga6-haskell-ide-engine-ghc843-0.14.0.0
/nix/store/1ynzvm8a5ah0yaanjyycxgxsi8ha6fm8-haskell-ide-engine-ghc844-0.14.0.0
/nix/store/ywiqwi0zk8f90xfngn2fy5v0j8mcg4k7-haskell-ide-engine-ghc861-0.14.0.0
/nix/store/k5bl1k6sxqzllxaq91y12k7issyx352n-haskell-ide-engine-ghc862-0.14.0.0
/nix/store/m2r5avlqd8jqwhadgnxh3mx9144c85sc-haskell-ide-engine-ghc863-0.14.0.0
/nix/store/kx888gg01y3j2r5ydfzqadb0v3mv1vyf-haskell-ide-engine-ghc864-0.14.0.0
/nix/store/6l9ciqyf5hrw7jrskwvfy60jayklrwdr-haskell-ide-engine-ghc865-0.14.0.0
# 0.13.0.0
## x86_64-linux
/nix/store/7xcbnma9w0678wjy8mqzmx8vr06ywr1q-haskell-ide-engine-ghc822-0.13.0.0
/nix/store/qqcjlnl0qcs06vk691nz9mq38kwb1b0m-haskell-ide-engine-ghc842-0.13.0.0
/nix/store/1bsinl1ipd4xd9a28mm870b585pr695j-haskell-ide-engine-ghc843-0.13.0.0
/nix/store/nrjf5k71rc7gbm24nzz3pm8dlhi9ffgj-haskell-ide-engine-ghc844-0.13.0.0
/nix/store/0fmpy958r9zzc9yarhjyq4j9sql4igh3-haskell-ide-engine-ghc861-0.13.0.0
/nix/store/72iwb479zlf1wir2zhy47w7j6ba24x8a-haskell-ide-engine-ghc862-0.13.0.0
/nix/store/wimhij1snfmz9bjjblspg6l3zjfbkpn1-haskell-ide-engine-ghc863-0.13.0.0
/nix/store/b54jxmrzs5y4mir3n5wz5n4xgvz6jzd3-haskell-ide-engine-ghc864-0.13.0.0
/nix/store/zz008pivvzzkmbwczax59kx9ik1vfcxh-haskell-ide-engine-ghc865-0.13.0.0
## x86_64-darwin
/nix/store/dwnjj266g3m2xyxxyjqj97r02bsmy1kw-haskell-ide-engine-ghc822-0.13.0.0
/nix/store/kpzxvzljbrpk8jk8kjc5am6vkvyp7sfr-haskell-ide-engine-ghc842-0.13.0.0
/nix/store/nvk48cyynyi482ihfhf6xi7nah3w0skl-haskell-ide-engine-ghc843-0.13.0.0
/nix/store/n1xy8781mlidx9wdn95sb7mic025n05y-haskell-ide-engine-ghc844-0.13.0.0
/nix/store/rksnq99m26ydi890jxgi2jh65b5ygvay-haskell-ide-engine-ghc861-0.13.0.0
/nix/store/y9bp4bpv2bp4m7cfv386c8kcfwx2qxmv-haskell-ide-engine-ghc862-0.13.0.0
/nix/store/03ixnk46zlvbvgagf7fnmwrra0351a6m-haskell-ide-engine-ghc863-0.13.0.0
/nix/store/596vx7bif80rkz633mg2zn91k0szrr60-haskell-ide-engine-ghc864-0.13.0.0
/nix/store/fnx9bhik3vrdxdfzqap9l4aph0a2cljc-haskell-ide-engine-ghc865-0.13.0.0
# 0.12.0.0
## x86_64-linux
/nix/store/vm2g0gka3wc9m2766s9f8xzrlliby5yi-haskell-ide-engine-ghc822-0.12.0.0
/nix/store/17ypzfshwxqb638bhxfbk6f6xzanzzsz-haskell-ide-engine-ghc842-0.12.0.0
/nix/store/6r4jbflxzx31n3bfy25blmy5prg0x1xr-haskell-ide-engine-ghc843-0.12.0.0
/nix/store/5ma13xjx2pvr97w1fmkz1hjy1pr0vzv7-haskell-ide-engine-ghc844-0.12.0.0
/nix/store/hqzbnrhagm1m0zkss5jf3sndfzipjk01-haskell-ide-engine-ghc861-0.12.0.0
/nix/store/6mdd6caab3qlnhbjr3c7jxki4dwkab9q-haskell-ide-engine-ghc862-0.12.0.0
/nix/store/55izx4ic9jh22pp2h75gsy75fwfnxl5c-haskell-ide-engine-ghc863-0.12.0.0
/nix/store/df49pvrydr12i8mk4l98vdhfvd0grbak-haskell-ide-engine-ghc864-0.12.0.0
/nix/store/qfpgpi3mcw8w0m6vdfn77bli5pdw8c1d-haskell-ide-engine-ghc865-0.12.0.0
## x86_64-darwin
/nix/store/2srmzjnzy2sjlrcd18mmmbjjlpmdwvjz-haskell-ide-engine-ghc822-0.12.0.0
/nix/store/58z40kd2wpqcm0i0npjbhy0rmy5x7xx2-haskell-ide-engine-ghc842-0.12.0.0
/nix/store/znlx4pq3gy4aish8bkm48pdix6a246y1-haskell-ide-engine-ghc843-0.12.0.0
/nix/store/zp8k0ili5k7amn3rl6rvsxsi6spcyqkc-haskell-ide-engine-ghc844-0.12.0.0
/nix/store/6kwk290gcvqydq5hlb4z1d79v9p1pzb2-haskell-ide-engine-ghc861-0.12.0.0
/nix/store/i3jwdmq0wyymsnbp7abwjxmy5kmyjjd5-haskell-ide-engine-ghc862-0.12.0.0
/nix/store/zhc4kvmcblsssflfiyr9f7p98prs38s4-haskell-ide-engine-ghc863-0.12.0.0
/nix/store/pshm49bih77bmnmyqhvav90vbbhiqan2-haskell-ide-engine-ghc864-0.12.0.0
/nix/store/n1dg6asggdi4v0k49pnwvfvzqazxcszc-haskell-ide-engine-ghc865-0.12.0.0
# 0.11.0.0
## x86_64-linux
/nix/store/bi1c5s6ql98hwbfnyr1hf5vy5g4qkyv9-haskell-ide-engine-ghc822-0.11.0.0
/nix/store/6yfa5vh4x3nc6a6skmsw311fbdr2sbgs-haskell-ide-engine-ghc842-0.11.0.0
/nix/store/4q1077xr3pxv218a61vzlk82g6mxaihd-haskell-ide-engine-ghc843-0.11.0.0
/nix/store/kvb4vqnbdh8gpj3y75ysixzwf165qib3-haskell-ide-engine-ghc844-0.11.0.0
/nix/store/fkrvvxxsqqyipj3832vfff75pv4ms5bd-haskell-ide-engine-ghc861-0.11.0.0
/nix/store/nacxmfd764v9g82gc345j1rapn2rhjnz-haskell-ide-engine-ghc862-0.11.0.0
/nix/store/q1pbpprnsqs1frjnlsjfzjvv4bi08vzj-haskell-ide-engine-ghc863-0.11.0.0
/nix/store/gw6pp5m05nvg7gshakaj4gcpq1fvg2w0-haskell-ide-engine-ghc864-0.11.0.0
/nix/store/h7hgxf86zfgh1dxv6jlybzlp96590q9j-haskell-ide-engine-ghc865-0.11.0.0
# x86_64-darwin
/nix/store/fqscw5v1fpza5wzw4fiw8810vy2581xg-haskell-ide-engine-ghc822-0.11.0.0
/nix/store/2r41givhaabpsrlf4djsbfb90p7nc63v-haskell-ide-engine-ghc842-0.11.0.0
/nix/store/fzkwrlvagpxss3b2xnbvmijmzl32xy8g-haskell-ide-engine-ghc843-0.11.0.0
/nix/store/cs29ppwf6q92lj5pwzz6989mq6g3smpv-haskell-ide-engine-ghc844-0.11.0.0
/nix/store/zqypv7cdjsm8wip289zg8x2c69df2svr-haskell-ide-engine-ghc861-0.11.0.0
/nix/store/ph1npnw2301xgi1v8cf660q7fx048w10-haskell-ide-engine-ghc862-0.11.0.0
/nix/store/zsmrfr9s9h8hkkwkiinpn81khip2zpdp-haskell-ide-engine-ghc863-0.11.0.0
/nix/store/10zbnxkfzxx5aza2b9yf1pdbj74lj44k-haskell-ide-engine-ghc864-0.11.0.0
/nix/store/s3mx14v0is47w6s1f59qds3cajzs1z1i-haskell-ide-engine-ghc865-0.11.0.0
# 0.10.0.0
## x86_64-linux
/nix/store/bqn4lhr3sy7l0js8i48cn8asdxch0fyg-haskell-ide-engine-ghc822-0.10.0.0
/nix/store/1zk8ak6xbj80xb1cwpfhvgfsqr6qc5nb-haskell-ide-engine-ghc842-0.10.0.0
/nix/store/xixdvl0zaxwxv7vg5yh5n1c3mfziylmy-haskell-ide-engine-ghc843-0.10.0.0
/nix/store/2vkknszx8a79zli4r7m1km0g5q839ljy-haskell-ide-engine-ghc844-0.10.0.0
/nix/store/5byn4lv9vs4sx8wbj4in33i6mrlhp10k-haskell-ide-engine-ghc861-0.10.0.0
/nix/store/624qszlz61jvmdr1nvmz7kf2akdjrn3d-haskell-ide-engine-ghc862-0.10.0.0
/nix/store/ix0cl548sg5kv5dw8baq429javdy2hb3-haskell-ide-engine-ghc863-0.10.0.0
/nix/store/w5xzzmmdm1kdfm195cq4blzv5dl69z6f-haskell-ide-engine-ghc864-0.10.0.0
/nix/store/aqb38lri5cw7bv1g8bh6md2z5kn3yq4f-haskell-ide-engine-ghc865-0.10.0.0
## x86_64-darwin
/nix/store/zg0swixk3v280xr3bxvly9csrf353xc8-haskell-ide-engine-ghc822-0.10.0.0
/nix/store/rxyizclnkfz7v5wmcffhppkfwbgxs8w2-haskell-ide-engine-ghc842-0.10.0.0
/nix/store/3hbzcabibrc67zjy6fxipzs9wbs6y164-haskell-ide-engine-ghc843-0.10.0.0
/nix/store/90z9h7ij4yhqi7bgr3jac4lnx70g6w1j-haskell-ide-engine-ghc844-0.10.0.0
/nix/store/0035fzz1923ybdq4wq9dqslv4mgxxxlb-haskell-ide-engine-ghc861-0.10.0.0
/nix/store/r529lppz0hcm0jf2qw5gb788d1piifhf-haskell-ide-engine-ghc862-0.10.0.0
/nix/store/939ipf6rw9hdq7j8zp31n3m0q97y462z-haskell-ide-engine-ghc863-0.10.0.0
/nix/store/sd86wdkix55i6zri12rl6inwbpsr1nmy-haskell-ide-engine-ghc864-0.10.0.0
/nix/store/cjkd4zxwg4p4zf1hps6hna47diddjd2b-haskell-ide-engine-ghc865-0.10.0.0
# 0.9.0.0
## x86_64-linux
/nix/store/826simd2sxai2ixp79sagig45fcqlbzx-haskell-ide-engine-ghc821-0.9.0.0
/nix/store/4l7cmyd7yz7f7fh9c7ncxp7a0ibkiyhk-haskell-ide-engine-ghc822-0.9.0.0
/nix/store/pfs0zmr1gj8m83cj811dxpqi38rngaby-haskell-ide-engine-ghc842-0.9.0.0
/nix/store/xbg2gz5h5grgksdj11fa5bn4g76pa205-haskell-ide-engine-ghc843-0.9.0.0
/nix/store/hpip464r63fgbm13gc2rvw4dgy5wx7jq-haskell-ide-engine-ghc844-0.9.0.0
/nix/store/93gs7s6fvvzjq5s65grm7ajnchc104mq-haskell-ide-engine-ghc861-0.9.0.0
/nix/store/fm6q1p4qahvpzwpzywhpmgpwdlqmalf5-haskell-ide-engine-ghc862-0.9.0.0
/nix/store/718j08f3sfrcznmg4jm468wi52ki8da9-haskell-ide-engine-ghc863-0.9.0.0
/nix/store/ykfwddgjmg8vaf7i83lbfpzmlc6ga0d0-haskell-ide-engine-ghc864-0.9.0.0
## x86_64-darwin
/nix/store/zjg7w8drvgajwg45kcwsrcgbfbyggjda-haskell-ide-engine-ghc821-0.9.0.0
/nix/store/9wds6q9cwl001z4ygdr2hh70y1db30j6-haskell-ide-engine-ghc822-0.9.0.0
/nix/store/srbrsjasysqvmva9sjzi5msf56jb9jih-haskell-ide-engine-ghc842-0.9.0.0
/nix/store/ijks8qwcpdnh4g8r09iz1jhlcviavnba-haskell-ide-engine-ghc843-0.9.0.0
/nix/store/js2qmcbkvc4nbjzj831lh3l8xb2rrlfv-haskell-ide-engine-ghc844-0.9.0.0
/nix/store/knmzrcwglv38h83awjczfxvr260i0mvz-haskell-ide-engine-ghc861-0.9.0.0
/nix/store/k0w4r4x6hghm4rniwpc00jv0w6grf44d-haskell-ide-engine-ghc862-0.9.0.0
/nix/store/h9q4ikqjwj2wzjgbhcxh8qkmlcd764kj-haskell-ide-engine-ghc863-0.9.0.0
/nix/store/5lwkwpgd9mdbrj2k267kjjslc5jmp2f4-haskell-ide-engine-ghc864-0.9.0.0
)
misslog=$(mktemp)
for path in ${storepaths[*]}; do
url=$(sed -r <<< $path \
-e 's|-.*|.narinfo|' \
-e 's|/nix/store|https://all-hies.cachix.org|')
{
code=$(curl -s -o /dev/null -w "%{http_code}\n" "$url")
case "$code" in
200)
echo "HIT $path"
;;
*)
echo -e "\e[01;31mMISS($code)\e[0m $path"
echo "" >> $misslog
;;
esac
} &
done
wait
misses=$(wc -l < "$misslog")
rm "$misslog"
exit "$misses"

View File

@ -1,202 +1,18 @@
# nixpkgs used only for library functions, not for dependencies
{ pkgs ? import ./nixpkgs.nix
, lib ? pkgs.lib
}:
{}:
let
legacyError = throw ''
all-hies has undergone major changes and now needs to be used on a per-project basis.
See https://github.com/Infinisil/all-hies/blob/master/Readme.md for more info.
The last version that doesn't have these changes is 4b6aab017cdf96a90641dc287437685675d598da.
'';
in {
overlay = import ./overlay.nix;
# A la lib.composeExtensions, but with any number of extensions
composeMultiple = extensions:
if extensions == [] then self: super: {}
else lib.composeExtensions
(lib.head extensions)
(composeMultiple (lib.tail extensions));
# Speeds up Haskell builds
speedierBuilds = self: super: {
mkDerivation = args: super.mkDerivation (args // {
enableLibraryProfiling = false;
});
};
ghcSpecific = buildName: ghcVersion: rec {
# Reformats the ghc version into the format "8.6.4"
versionString = lib.concatStringsSep "."
(builtins.match "ghc(.)(.)(.)" ghcVersion);
# The more recent the version, the higher the priority
# But higher priorities are lower on the number scale (WHY?), so we need the -
versionPriority = - lib.toInt (lib.head (builtins.match "ghc(.*)" ghcVersion));
# Evaluates to a nixpkgs that has the given ghc version in it
pkgs = let
rev = builtins.readFile (./nixpkgsForGhc + "/${ghcVersion}");
sha256 = builtins.readFile (./generated + "/${buildName}/nixpkgsHashes/${rev}");
in import (fetchTarball {
url = "https://github.com/NixOS/nixpkgs/tarball/${rev}";
inherit sha256;
}) { config = {}; overlays = []; };
# Returns a Haskell overlay that sets all ghc base libraries to null
# (minus a select few)
baseLibraryNuller = self: super: let
libs = lib.splitString " "
(builtins.readFile (./generated + "/${buildName}/ghcBaseLibraries/${ghcVersion}"));
libNames = map (lib: (builtins.parseDrvName lib).name) libs;
# It seems that some versions require Cabal and some don't
filtered = lib.filter (name: ! lib.elem name [ "ghc" "Cabal" ]) libNames;
in lib.genAttrs filtered (name: null);
# Custom overrides for specific ghc versions, declared in ./overrides
customOverrides =
let path = ./overrides + "/${ghcVersion}.nix";
in if builtins.pathExists path then import path
else self: super: {};
};
# Build for a specific GHC version
hieBuild = buildName: ghcVersion: let
forGhc = ghcSpecific buildName ghcVersion;
hlib = forGhc.pkgs.haskell.lib;
revision = builtins.readFile (./generated + "/${buildName}/stack2nix/revision");
hieOverride = self: super: {
haskell-ide-engine = (hlib.overrideCabal super.haskell-ide-engine (old: {
# Embed the ghc version into the name
pname = "${old.pname}-${ghcVersion}";
version = revision;
# Link Haskell libraries dynamically, improves startup time for projects
# using TH by a lot (40x faster in one of my tests), but also Increases
# closure size by about 50% (=~ 1.2GB) per HIE version
# Can be disabled again for GHC versions that have a fix for
# https://gitlab.haskell.org/ghc/ghc/issues/15524
enableSharedExecutables = true;
isLibrary = false;
doHaddock = false;
})).overrideAttrs (old: {
nativeBuildInputs = old.nativeBuildInputs or [] ++ [ pkgs.makeWrapper ];
# Make sure hie-x.x.x binary exists
# And make sure hie-wrapper finds this version
postInstall = old.postInstall or "" + ''
ln -s hie $out/bin/hie-${forGhc.versionString}
wrapProgram $out/bin/hie-wrapper \
--suffix PATH : $out/bin
'';
# Assign a priority for allowing multiple versions to be installed at once
meta = old.meta // {
priority = forGhc.versionPriority;
};
});
};
overrideFun = old: {
overrides = composeMultiple [
(old.overrides or (self: super: {}))
speedierBuilds
hieOverride
forGhc.baseLibraryNuller
forGhc.customOverrides
];
};
expr = import (./generated + "/${buildName}/stack2nix/${ghcVersion}.nix") {
pkgs = forGhc.pkgs;
};
hpkgs = expr.override overrideFun;
build = hpkgs.haskell-ide-engine // {
inherit (hpkgs) hie-bios;
};
in build;
# A set of all ghc versions for all hie versions, like
# { stable = { ghc864 = <derivation ..>; ... }; unstable = ...; }
# Each of which contain binaries hie and hie-$major.$minor.$patch for their
# GHC version, along with a hie-wrapper binary that knows about this version
allVersions = lib.mapAttrs (buildName: _:
let ghcVersionFiles = lib.filterAttrs (file: _: file != "revision")
(builtins.readDir (./generated + "/${buildName}/stack2nix"));
in lib.mapAttrs' (ghcVersionFile: _:
let ghcVersion = lib.removeSuffix ".nix" ghcVersionFile;
in lib.nameValuePair ghcVersion (hieBuild buildName ghcVersion)
) ghcVersionFiles) (builtins.readDir ./generated);
# Combine a set of HIE versions (given as { <ghcVersion> = <derivation>; })
# into a single derivation with the following binaries:
# - hie-*.*.*: The GHC specific HIE versions, such as ghc-8.6.4
# - hie-wrapper: A HIE version that selects the appropriate version
# automatically out of the given ones
# - hie: Same as hie-wrapper, provided for easy editor integration
combined = versions: pkgs.buildEnv {
name = "haskell-ide-engine-combined";
paths = lib.attrValues versions ++ [ (lib.last (lib.attrValues versions)).hie-bios ];
buildInputs = [ pkgs.makeWrapper ];
pathsToLink = [ "/bin" ];
extraPrefix = "/libexec";
postBuild = ''
# Remove hie/hie-wrapper in /libexec/bin because those are both just PATH
# wrapped versions. Move the actual hie-wrapper to $out/bin
rm $out/libexec/bin/{hie,hie-wrapper}
mkdir -p $out/bin
mv $out/libexec/bin/.hie-wrapper-wrapped $out/bin/hie-wrapper
mv $out/libexec/bin/hie-bios $out/bin/hie-bios
# Now /libexec/bin only contains binaries hie-*.*.*. Link all of them to
# $out/bin such that users installing this directly can access these
# specific versions too in $PATH
for bin in $out/libexec/bin/*; do
ln -s ../libexec/bin/$(basename $bin) $out/bin/$(basename $bin)
done
# Because we don't want hie-wrapper to fall back to hie binaries later in
# PATH (because if this derivation is installed, a later hie might be
# hie-wrapper itself, leading to infinite process recursion), we provide
# our own hie binary instead, which will only be called if it couldn't
# find any appropriate hie-*.*.* binary, in which case the user needs to
# adjust their all-hies installation to make that one available.
cat > $out/libexec/bin/hie << EOF
#!${pkgs.runtimeShell}
echo "hie-wrapper couldn't find a HIE binary with a matching GHC" \\
"version in your all-hies installation" >&2
exit 1
EOF
chmod +x $out/libexec/bin/hie
# Wrap hie-wrapper with PATH prefixed with /libexec/bin, such
# that it can find all those binaries. Not --suffix because
# hie-wrapper needs to find our hie binary first and foremost as per
# above comment, also makes it more reproducible. Not --set because hie
# needs to find binaries for cabal/ghc and such.
wrapProgram $out/bin/hie-wrapper \
--prefix PATH : $out/libexec/bin
# Make hie-wrapper available as hie as well, in order to minimize the need
# for customizing editors, and to override a potential hie binary from
# another derivation in the same environment.
ln -s hie-wrapper $out/bin/hie
'';
};
# Generates a set with the utility functions from a set of versions
mkSet = versions: {
inherit combined versions;
selection = { selector }: combined (selector versions);
latest = lib.last (lib.attrValues versions);
};
in mkSet allVersions.stable
// lib.mapAttrs (_: mkSet) (builtins.removeAttrs allVersions ["stable"])
// {
bios = throw "all-hies: All versions now have hie-bios support, no need to use the bios attribute anymore";
# Stable, but fall back to unstable if stable doesn't have a certain GHC
# version
unstableFallback = mkSet (allVersions.unstable // allVersions.stable);
combined = legacyError;
versions = legacyError;
selection = legacyError;
latest = legacyError;
unstable = legacyError;
bios = legacyError;
unstableFallback = legacyError;
}

3
generated/8.6.5/materialization-id generated Normal file
View File

@ -0,0 +1,3 @@
These materialization files were generated with
haskell.nix af5998fe8d6b201d2a9be09993f1b9fae74e0082
haskell-ide-engine fe630a1e31232013549518909e511924e19af4af

View File

64
generated/8.6.5/materialized/default.nix generated Normal file
View File

@ -0,0 +1,64 @@
{
extras = hackage:
{
packages = {
"aeson" = (((hackage.aeson)."1.4.6.0").revisions).default;
"aeson-pretty" = (((hackage.aeson-pretty)."0.8.8").revisions).default;
"ansi-terminal" = (((hackage.ansi-terminal)."0.10.2").revisions).default;
"ansi-wl-pprint" = (((hackage.ansi-wl-pprint)."0.6.9").revisions).default;
"base-compat" = (((hackage.base-compat)."0.11.1").revisions).default;
"brittany" = (((hackage.brittany)."0.12.1.1").revisions).default;
"bytestring-trie" = (((hackage.bytestring-trie)."0.2.5.0").revisions).default;
"Cabal" = (((hackage.Cabal)."3.0.2.0").revisions).default;
"cabal-helper" = (((hackage.cabal-helper)."1.1.0.0").revisions).default;
"cabal-plan" = (((hackage.cabal-plan)."0.6.2.0").revisions).default;
"clock" = (((hackage.clock)."0.7.2").revisions).default;
"constrained-dynamic" = (((hackage.constrained-dynamic)."0.1.0.0").revisions).default;
"extra" = (((hackage.extra)."1.6.21").revisions).default;
"floskell" = (((hackage.floskell)."0.10.2").revisions).default;
"ghc-exactprint" = (((hackage.ghc-exactprint)."0.6.2").revisions).default;
"ghc-lib-parser" = (((hackage.ghc-lib-parser)."8.8.2.20200205").revisions).default;
"ghc-lib-parser-ex" = (((hackage.ghc-lib-parser-ex)."8.8.5.3").revisions).default;
"haskell-lsp" = (((hackage.haskell-lsp)."0.20.0.0").revisions).default;
"haskell-lsp-types" = (((hackage.haskell-lsp-types)."0.20.0.0").revisions).default;
"haskell-src-exts" = (((hackage.haskell-src-exts)."1.22.0").revisions).default;
"hie-bios" = (((hackage.hie-bios)."0.5.0").revisions).default;
"hlint" = (((hackage.hlint)."2.2.11").revisions).default;
"hoogle" = (((hackage.hoogle)."5.0.17.15").revisions).default;
"indexed-profunctors" = (((hackage.indexed-profunctors)."0.1").revisions).default;
"lens" = (((hackage.lens)."4.18").revisions).default;
"lsp-test" = (((hackage.lsp-test)."0.10.1.0").revisions).default;
"monad-dijkstra" = (((hackage.monad-dijkstra)."0.1.1.2").revisions).default;
"optics-core" = (((hackage.optics-core)."0.2").revisions).default;
"optparse-applicative" = (((hackage.optparse-applicative)."0.15.1.0").revisions).default;
"ormolu" = (((hackage.ormolu)."0.0.3.1").revisions).default;
"parser-combinators" = (((hackage.parser-combinators)."1.2.1").revisions).default;
"resourcet" = (((hackage.resourcet)."1.2.3").revisions).default;
"semialign" = (((hackage.semialign)."1.1").revisions).default;
"temporary" = (((hackage.temporary)."1.2.1.1").revisions).default;
"topograph" = (((hackage.topograph)."1").revisions).default;
"type-equality" = (((hackage.type-equality)."1").revisions).default;
"unliftio" = (((hackage.unliftio)."0.2.12.1").revisions).default;
"unliftio-core" = (((hackage.unliftio-core)."0.2.0.1").revisions).default;
"haddock-api" = (((hackage.haddock-api)."2.22.0").revisions).r1;
"hsimport" = (((hackage.hsimport)."0.11.0").revisions).r2;
haskell-ide-engine = ./haskell-ide-engine.nix;
hie-plugin-api = ./hie-plugin-api.nix;
};
};
resolver = "lts-14.22";
modules = [
({ lib, ... }:
{
packages = {
"haskell-ide-engine" = {
flags = { "pedantic" = lib.mkOverride 900 true; };
};
"hie-plugin-api" = {
flags = { "pedantic" = lib.mkOverride 900 true; };
};
};
})
{ packages = {}; }
];
}

View File

@ -0,0 +1,358 @@
{ system
, compiler
, flags
, pkgs
, hsPkgs
, pkgconfPkgs
, errorHandler
, config
, ... }:
{
flags = { pedantic = false; };
package = {
specVersion = "2.0";
identifier = { name = "haskell-ide-engine"; version = "1.4"; };
license = "BSD-3-Clause";
copyright = "2015 - 2019, TBD";
maintainer = "alan.zimm@gmail.com (for now)";
author = "Many, TBD when we release";
homepage = "http://github.com/githubuser/haskell-ide-engine#readme";
url = "";
synopsis = "Provide a common engine to power any Haskell IDE";
description = "Please see README.md";
buildType = "Simple";
isLocal = true;
detailLevel = "FullDetails";
licenseFiles = [ "LICENSE" ];
dataDir = "";
dataFiles = [];
extraSrcFiles = [];
extraTmpFiles = [];
extraDocFiles = [];
};
components = {
"library" = {
depends = [
(hsPkgs."Cabal" or (errorHandler.buildDepError "Cabal"))
(hsPkgs."Diff" or (errorHandler.buildDepError "Diff"))
(hsPkgs."aeson" or (errorHandler.buildDepError "aeson"))
(hsPkgs."apply-refact" or (errorHandler.buildDepError "apply-refact"))
(hsPkgs."async" or (errorHandler.buildDepError "async"))
(hsPkgs."base" or (errorHandler.buildDepError "base"))
(hsPkgs."brittany" or (errorHandler.buildDepError "brittany"))
(hsPkgs."bytestring" or (errorHandler.buildDepError "bytestring"))
(hsPkgs."Cabal" or (errorHandler.buildDepError "Cabal"))
(hsPkgs."cabal-helper" or (errorHandler.buildDepError "cabal-helper"))
(hsPkgs."containers" or (errorHandler.buildDepError "containers"))
(hsPkgs."data-default" or (errorHandler.buildDepError "data-default"))
(hsPkgs."directory" or (errorHandler.buildDepError "directory"))
(hsPkgs."filepath" or (errorHandler.buildDepError "filepath"))
(hsPkgs."floskell" or (errorHandler.buildDepError "floskell"))
(hsPkgs."fold-debounce" or (errorHandler.buildDepError "fold-debounce"))
(hsPkgs."ghc" or (errorHandler.buildDepError "ghc"))
(hsPkgs."ghc-exactprint" or (errorHandler.buildDepError "ghc-exactprint"))
(hsPkgs."gitrev" or (errorHandler.buildDepError "gitrev"))
(hsPkgs."haddock-api" or (errorHandler.buildDepError "haddock-api"))
(hsPkgs."haddock-library" or (errorHandler.buildDepError "haddock-library"))
(hsPkgs."haskell-lsp" or (errorHandler.buildDepError "haskell-lsp"))
(hsPkgs."haskell-lsp-types" or (errorHandler.buildDepError "haskell-lsp-types"))
(hsPkgs."haskell-src-exts" or (errorHandler.buildDepError "haskell-src-exts"))
(hsPkgs."hie-plugin-api" or (errorHandler.buildDepError "hie-plugin-api"))
(hsPkgs."hoogle" or (errorHandler.buildDepError "hoogle"))
(hsPkgs."hsimport" or (errorHandler.buildDepError "hsimport"))
(hsPkgs."hslogger" or (errorHandler.buildDepError "hslogger"))
(hsPkgs."lifted-async" or (errorHandler.buildDepError "lifted-async"))
(hsPkgs."lens" or (errorHandler.buildDepError "lens"))
(hsPkgs."monoid-subclasses" or (errorHandler.buildDepError "monoid-subclasses"))
(hsPkgs."mtl" or (errorHandler.buildDepError "mtl"))
(hsPkgs."optparse-simple" or (errorHandler.buildDepError "optparse-simple"))
(hsPkgs."parsec" or (errorHandler.buildDepError "parsec"))
(hsPkgs."process" or (errorHandler.buildDepError "process"))
(hsPkgs."safe" or (errorHandler.buildDepError "safe"))
(hsPkgs."sorted-list" or (errorHandler.buildDepError "sorted-list"))
(hsPkgs."stm" or (errorHandler.buildDepError "stm"))
(hsPkgs."syb" or (errorHandler.buildDepError "syb"))
(hsPkgs."tagsoup" or (errorHandler.buildDepError "tagsoup"))
(hsPkgs."text" or (errorHandler.buildDepError "text"))
(hsPkgs."transformers" or (errorHandler.buildDepError "transformers"))
(hsPkgs."unix-time" or (errorHandler.buildDepError "unix-time"))
(hsPkgs."unordered-containers" or (errorHandler.buildDepError "unordered-containers"))
(hsPkgs."vector" or (errorHandler.buildDepError "vector"))
(hsPkgs."versions" or (errorHandler.buildDepError "versions"))
(hsPkgs."yaml" or (errorHandler.buildDepError "yaml"))
(hsPkgs."hie-bios" or (errorHandler.buildDepError "hie-bios"))
(hsPkgs."bytestring-trie" or (errorHandler.buildDepError "bytestring-trie"))
(hsPkgs."unliftio" or (errorHandler.buildDepError "unliftio"))
(hsPkgs."hlint" or (errorHandler.buildDepError "hlint"))
] ++ (pkgs.lib).optional (compiler.isGhc && (compiler.version).ge "8.6") (hsPkgs."ormolu" or (errorHandler.buildDepError "ormolu"));
buildable = true;
modules = [
"Paths_haskell_ide_engine"
"Haskell/Ide/Engine/Channel"
"Haskell/Ide/Engine/CodeActions"
"Haskell/Ide/Engine/Completions"
"Haskell/Ide/Engine/Reactor"
"Haskell/Ide/Engine/Options"
"Haskell/Ide/Engine/Plugin/ApplyRefact"
"Haskell/Ide/Engine/Plugin/Brittany"
"Haskell/Ide/Engine/Plugin/Example2"
"Haskell/Ide/Engine/Plugin/Floskell"
"Haskell/Ide/Engine/Plugin/Haddock"
"Haskell/Ide/Engine/Plugin/HfaAlign"
"Haskell/Ide/Engine/Plugin/HsImport"
"Haskell/Ide/Engine/Plugin/Liquid"
"Haskell/Ide/Engine/Plugin/Ormolu"
"Haskell/Ide/Engine/Plugin/Package"
"Haskell/Ide/Engine/Plugin/Package/Compat"
"Haskell/Ide/Engine/Plugin/Pragmas"
"Haskell/Ide/Engine/Plugin/Generic"
"Haskell/Ide/Engine/Plugin/GhcMod"
"Haskell/Ide/Engine/Scheduler"
"Haskell/Ide/Engine/Support/FromHaRe"
"Haskell/Ide/Engine/Support/Hoogle"
"Haskell/Ide/Engine/Support/Fuzzy"
"Haskell/Ide/Engine/Support/HieExtras"
"Haskell/Ide/Engine/Server"
"Haskell/Ide/Engine/Types"
"Haskell/Ide/Engine/Version"
];
hsSourceDirs = [ "src" ];
};
sublibs = {
"hie-test-utils" = {
depends = [
(hsPkgs."base" or (errorHandler.buildDepError "base"))
(hsPkgs."haskell-ide-engine" or (errorHandler.buildDepError "haskell-ide-engine"))
(hsPkgs."haskell-lsp" or (errorHandler.buildDepError "haskell-lsp"))
(hsPkgs."hie-bios" or (errorHandler.buildDepError "hie-bios"))
(hsPkgs."hie-plugin-api" or (errorHandler.buildDepError "hie-plugin-api"))
(hsPkgs."aeson" or (errorHandler.buildDepError "aeson"))
(hsPkgs."blaze-markup" or (errorHandler.buildDepError "blaze-markup"))
(hsPkgs."containers" or (errorHandler.buildDepError "containers"))
(hsPkgs."data-default" or (errorHandler.buildDepError "data-default"))
(hsPkgs."directory" or (errorHandler.buildDepError "directory"))
(hsPkgs."filepath" or (errorHandler.buildDepError "filepath"))
(hsPkgs."hslogger" or (errorHandler.buildDepError "hslogger"))
(hsPkgs."hspec" or (errorHandler.buildDepError "hspec"))
(hsPkgs."hspec-core" or (errorHandler.buildDepError "hspec-core"))
(hsPkgs."stm" or (errorHandler.buildDepError "stm"))
(hsPkgs."text" or (errorHandler.buildDepError "text"))
(hsPkgs."unordered-containers" or (errorHandler.buildDepError "unordered-containers"))
(hsPkgs."yaml" or (errorHandler.buildDepError "yaml"))
];
buildable = true;
modules = [ "TestUtils" ];
hsSourceDirs = [ "test/utils" ];
};
};
exes = {
"hie" = {
depends = [
(hsPkgs."base" or (errorHandler.buildDepError "base"))
(hsPkgs."containers" or (errorHandler.buildDepError "containers"))
(hsPkgs."data-default" or (errorHandler.buildDepError "data-default"))
(hsPkgs."directory" or (errorHandler.buildDepError "directory"))
(hsPkgs."filepath" or (errorHandler.buildDepError "filepath"))
(hsPkgs."ghc" or (errorHandler.buildDepError "ghc"))
(hsPkgs."hie-bios" or (errorHandler.buildDepError "hie-bios"))
(hsPkgs."haskell-ide-engine" or (errorHandler.buildDepError "haskell-ide-engine"))
(hsPkgs."haskell-lsp" or (errorHandler.buildDepError "haskell-lsp"))
(hsPkgs."haskell-lsp-types" or (errorHandler.buildDepError "haskell-lsp-types"))
(hsPkgs."hie-plugin-api" or (errorHandler.buildDepError "hie-plugin-api"))
(hsPkgs."hslogger" or (errorHandler.buildDepError "hslogger"))
(hsPkgs."optparse-simple" or (errorHandler.buildDepError "optparse-simple"))
(hsPkgs."stm" or (errorHandler.buildDepError "stm"))
(hsPkgs."text" or (errorHandler.buildDepError "text"))
(hsPkgs."yaml" or (errorHandler.buildDepError "yaml"))
];
buildable = true;
modules = [ "Paths_haskell_ide_engine" "RunTest" ];
hsSourceDirs = [ "app" ];
mainPath = [
"MainHie.hs"
] ++ (pkgs.lib).optional (flags.pedantic) "";
};
"hie-wrapper" = {
depends = [
(hsPkgs."base" or (errorHandler.buildDepError "base"))
(hsPkgs."directory" or (errorHandler.buildDepError "directory"))
(hsPkgs."filepath" or (errorHandler.buildDepError "filepath"))
(hsPkgs."hie-bios" or (errorHandler.buildDepError "hie-bios"))
(hsPkgs."haskell-ide-engine" or (errorHandler.buildDepError "haskell-ide-engine"))
(hsPkgs."haskell-lsp" or (errorHandler.buildDepError "haskell-lsp"))
(hsPkgs."hie-plugin-api" or (errorHandler.buildDepError "hie-plugin-api"))
(hsPkgs."hslogger" or (errorHandler.buildDepError "hslogger"))
(hsPkgs."optparse-simple" or (errorHandler.buildDepError "optparse-simple"))
(hsPkgs."process" or (errorHandler.buildDepError "process"))
];
buildable = true;
modules = [ "Paths_haskell_ide_engine" ];
hsSourceDirs = [ "app" ];
mainPath = [
"HieWrapper.hs"
] ++ (pkgs.lib).optional (flags.pedantic) "";
};
};
tests = {
"unit-test" = {
depends = [
(hsPkgs."QuickCheck" or (errorHandler.buildDepError "QuickCheck"))
(hsPkgs."aeson" or (errorHandler.buildDepError "aeson"))
(hsPkgs."cabal-helper" or (errorHandler.buildDepError "cabal-helper"))
(hsPkgs."ghc" or (errorHandler.buildDepError "ghc"))
(hsPkgs."base" or (errorHandler.buildDepError "base"))
(hsPkgs."bytestring" or (errorHandler.buildDepError "bytestring"))
(hsPkgs."containers" or (errorHandler.buildDepError "containers"))
(hsPkgs."directory" or (errorHandler.buildDepError "directory"))
(hsPkgs."filepath" or (errorHandler.buildDepError "filepath"))
(hsPkgs."free" or (errorHandler.buildDepError "free"))
(hsPkgs."ghc" or (errorHandler.buildDepError "ghc"))
(hsPkgs."haskell-ide-engine" or (errorHandler.buildDepError "haskell-ide-engine"))
(hsPkgs."haskell-lsp-types" or (errorHandler.buildDepError "haskell-lsp-types"))
(hsPkgs."hie-bios" or (errorHandler.buildDepError "hie-bios"))
(hsPkgs."hie-test-utils" or (errorHandler.buildDepError "hie-test-utils"))
(hsPkgs."hie-plugin-api" or (errorHandler.buildDepError "hie-plugin-api"))
(hsPkgs."hoogle" or (errorHandler.buildDepError "hoogle"))
(hsPkgs."hspec" or (errorHandler.buildDepError "hspec"))
(hsPkgs."optparse-applicative" or (errorHandler.buildDepError "optparse-applicative"))
(hsPkgs."process" or (errorHandler.buildDepError "process"))
(hsPkgs."quickcheck-instances" or (errorHandler.buildDepError "quickcheck-instances"))
(hsPkgs."text" or (errorHandler.buildDepError "text"))
(hsPkgs."unordered-containers" or (errorHandler.buildDepError "unordered-containers"))
];
build-tools = [
(hsPkgs.buildPackages.cabal-helper or (pkgs.buildPackages.cabal-helper or (errorHandler.buildToolDepError "cabal-helper")))
(hsPkgs.buildPackages.hspec-discover or (pkgs.buildPackages.hspec-discover or (errorHandler.buildToolDepError "hspec-discover")))
];
buildable = true;
modules = [
"ApplyRefactPluginSpec"
"CabalHelperSpec"
"CodeActionsSpec"
"ContextSpec"
"DiffSpec"
"ExtensibleStateSpec"
"GenericPluginSpec"
"GhcModPluginSpec"
"HooglePluginSpec"
"HsImportSpec"
"JsonSpec"
"LiquidSpec"
"OptionsSpec"
"PackagePluginSpec"
"Paths_haskell_ide_engine"
"Spec"
];
hsSourceDirs = [ "test/unit" ];
mainPath = [ "Main.hs" ];
};
"dispatcher-test" = {
depends = [
(hsPkgs."base" or (errorHandler.buildDepError "base"))
(hsPkgs."aeson" or (errorHandler.buildDepError "aeson"))
(hsPkgs."data-default" or (errorHandler.buildDepError "data-default"))
(hsPkgs."directory" or (errorHandler.buildDepError "directory"))
(hsPkgs."filepath" or (errorHandler.buildDepError "filepath"))
(hsPkgs."ghc" or (errorHandler.buildDepError "ghc"))
(hsPkgs."haskell-ide-engine" or (errorHandler.buildDepError "haskell-ide-engine"))
(hsPkgs."haskell-lsp-types" or (errorHandler.buildDepError "haskell-lsp-types"))
(hsPkgs."hie-test-utils" or (errorHandler.buildDepError "hie-test-utils"))
(hsPkgs."hie-plugin-api" or (errorHandler.buildDepError "hie-plugin-api"))
(hsPkgs."hspec" or (errorHandler.buildDepError "hspec"))
(hsPkgs."stm" or (errorHandler.buildDepError "stm"))
(hsPkgs."text" or (errorHandler.buildDepError "text"))
(hsPkgs."unordered-containers" or (errorHandler.buildDepError "unordered-containers"))
];
build-tools = [
(hsPkgs.buildPackages.hspec-discover or (pkgs.buildPackages.hspec-discover or (errorHandler.buildToolDepError "hspec-discover")))
];
buildable = true;
hsSourceDirs = [ "test/dispatcher" ];
mainPath = [ "Main.hs" ];
};
"plugin-dispatcher-test" = {
depends = [
(hsPkgs."base" or (errorHandler.buildDepError "base"))
(hsPkgs."data-default" or (errorHandler.buildDepError "data-default"))
(hsPkgs."directory" or (errorHandler.buildDepError "directory"))
(hsPkgs."filepath" or (errorHandler.buildDepError "filepath"))
(hsPkgs."haskell-ide-engine" or (errorHandler.buildDepError "haskell-ide-engine"))
(hsPkgs."haskell-lsp-types" or (errorHandler.buildDepError "haskell-lsp-types"))
(hsPkgs."hie-plugin-api" or (errorHandler.buildDepError "hie-plugin-api"))
(hsPkgs."hie-test-utils" or (errorHandler.buildDepError "hie-test-utils"))
(hsPkgs."hspec" or (errorHandler.buildDepError "hspec"))
(hsPkgs."stm" or (errorHandler.buildDepError "stm"))
(hsPkgs."text" or (errorHandler.buildDepError "text"))
];
buildable = true;
hsSourceDirs = [ "test/plugin-dispatcher" ];
mainPath = [ "Main.hs" ];
};
"func-test" = {
depends = [
(hsPkgs."aeson" or (errorHandler.buildDepError "aeson"))
(hsPkgs."base" or (errorHandler.buildDepError "base"))
(hsPkgs."data-default" or (errorHandler.buildDepError "data-default"))
(hsPkgs."directory" or (errorHandler.buildDepError "directory"))
(hsPkgs."filepath" or (errorHandler.buildDepError "filepath"))
(hsPkgs."lsp-test" or (errorHandler.buildDepError "lsp-test"))
(hsPkgs."haskell-ide-engine" or (errorHandler.buildDepError "haskell-ide-engine"))
(hsPkgs."haskell-lsp-types" or (errorHandler.buildDepError "haskell-lsp-types"))
(hsPkgs."haskell-lsp" or (errorHandler.buildDepError "haskell-lsp"))
(hsPkgs."hie-test-utils" or (errorHandler.buildDepError "hie-test-utils"))
(hsPkgs."hie-plugin-api" or (errorHandler.buildDepError "hie-plugin-api"))
(hsPkgs."hspec" or (errorHandler.buildDepError "hspec"))
(hsPkgs."lens" or (errorHandler.buildDepError "lens"))
(hsPkgs."text" or (errorHandler.buildDepError "text"))
(hsPkgs."unordered-containers" or (errorHandler.buildDepError "unordered-containers"))
(hsPkgs."containers" or (errorHandler.buildDepError "containers"))
];
build-tools = [
(hsPkgs.buildPackages.hspec-discover or (pkgs.buildPackages.hspec-discover or (errorHandler.buildToolDepError "hspec-discover")))
(hsPkgs.buildPackages.haskell-ide-engine or (pkgs.buildPackages.haskell-ide-engine or (errorHandler.buildToolDepError "haskell-ide-engine")))
(hsPkgs.buildPackages.cabal-helper or (pkgs.buildPackages.cabal-helper or (errorHandler.buildToolDepError "cabal-helper")))
];
buildable = true;
modules = [
"CompletionSpec"
"CommandSpec"
"DeferredSpec"
"DefinitionSpec"
"DiagnosticsSpec"
"FormatSpec"
"FunctionalBadProjectSpec"
"FunctionalCodeActionsSpec"
"FunctionalLiquidSpec"
"FunctionalSpec"
"HieBiosSpec"
"HighlightSpec"
"HoverSpec"
"ProgressSpec"
"ReferencesSpec"
"RenameSpec"
"SymbolsSpec"
"TypeDefinitionSpec"
"Utils"
];
hsSourceDirs = [ "test/functional" ];
mainPath = [ "Main.hs" ];
};
"wrapper-test" = {
depends = [
(hsPkgs."base" or (errorHandler.buildDepError "base"))
(hsPkgs."hspec" or (errorHandler.buildDepError "hspec"))
(hsPkgs."directory" or (errorHandler.buildDepError "directory"))
(hsPkgs."filepath" or (errorHandler.buildDepError "filepath"))
(hsPkgs."process" or (errorHandler.buildDepError "process"))
(hsPkgs."haskell-ide-engine" or (errorHandler.buildDepError "haskell-ide-engine"))
(hsPkgs."hie-plugin-api" or (errorHandler.buildDepError "hie-plugin-api"))
];
buildable = true;
hsSourceDirs = [ "test/wrapper" ];
mainPath = [ "HieWrapper.hs" ];
};
};
};
} // rec {
src = (pkgs.lib).mkDefault ./.;
}

View File

@ -0,0 +1,95 @@
{ system
, compiler
, flags
, pkgs
, hsPkgs
, pkgconfPkgs
, errorHandler
, config
, ... }:
{
flags = { pedantic = false; };
package = {
specVersion = "2.0";
identifier = { name = "hie-plugin-api"; version = "1.4"; };
license = "BSD-3-Clause";
copyright = "2015 TBD";
maintainer = "alan.zimm@gmail.com (for now)";
author = "Many,TBD when we release";
homepage = "";
url = "";
synopsis = "Haskell IDE API for plugin communication";
description = "Please see README.md";
buildType = "Simple";
isLocal = true;
detailLevel = "FullDetails";
licenseFiles = [ "LICENSE" ];
dataDir = "";
dataFiles = [];
extraSrcFiles = [];
extraTmpFiles = [];
extraDocFiles = [];
};
components = {
"library" = {
depends = [
(hsPkgs."base" or (errorHandler.buildDepError "base"))
(hsPkgs."Diff" or (errorHandler.buildDepError "Diff"))
(hsPkgs."aeson" or (errorHandler.buildDepError "aeson"))
(hsPkgs."bytestring-trie" or (errorHandler.buildDepError "bytestring-trie"))
(hsPkgs."bytestring" or (errorHandler.buildDepError "bytestring"))
(hsPkgs."cryptohash-sha1" or (errorHandler.buildDepError "cryptohash-sha1"))
(hsPkgs."constrained-dynamic" or (errorHandler.buildDepError "constrained-dynamic"))
(hsPkgs."containers" or (errorHandler.buildDepError "containers"))
(hsPkgs."data-default" or (errorHandler.buildDepError "data-default"))
(hsPkgs."directory" or (errorHandler.buildDepError "directory"))
(hsPkgs."filepath" or (errorHandler.buildDepError "filepath"))
(hsPkgs."fingertree" or (errorHandler.buildDepError "fingertree"))
(hsPkgs."free" or (errorHandler.buildDepError "free"))
(hsPkgs."ghc" or (errorHandler.buildDepError "ghc"))
(hsPkgs."hie-bios" or (errorHandler.buildDepError "hie-bios"))
(hsPkgs."cabal-helper" or (errorHandler.buildDepError "cabal-helper"))
(hsPkgs."haskell-lsp" or (errorHandler.buildDepError "haskell-lsp"))
(hsPkgs."hslogger" or (errorHandler.buildDepError "hslogger"))
(hsPkgs."unliftio" or (errorHandler.buildDepError "unliftio"))
(hsPkgs."unliftio-core" or (errorHandler.buildDepError "unliftio-core"))
(hsPkgs."monad-control" or (errorHandler.buildDepError "monad-control"))
(hsPkgs."mtl" or (errorHandler.buildDepError "mtl"))
(hsPkgs."process" or (errorHandler.buildDepError "process"))
(hsPkgs."sorted-list" or (errorHandler.buildDepError "sorted-list"))
(hsPkgs."stm" or (errorHandler.buildDepError "stm"))
(hsPkgs."syb" or (errorHandler.buildDepError "syb"))
(hsPkgs."text" or (errorHandler.buildDepError "text"))
(hsPkgs."transformers" or (errorHandler.buildDepError "transformers"))
(hsPkgs."unordered-containers" or (errorHandler.buildDepError "unordered-containers"))
(hsPkgs."transformers-base" or (errorHandler.buildDepError "transformers-base"))
(hsPkgs."yaml" or (errorHandler.buildDepError "yaml"))
] ++ (if system.isWindows
then [ (hsPkgs."Win32" or (errorHandler.buildDepError "Win32")) ]
else [ (hsPkgs."unix" or (errorHandler.buildDepError "unix")) ]);
buildable = true;
modules = [
"Haskell/Ide/Engine/ArtifactMap"
"Haskell/Ide/Engine/Compat"
"Haskell/Ide/Engine/Cradle"
"Haskell/Ide/Engine/GhcCompat"
"Haskell/Ide/Engine/GhcUtils"
"Haskell/Ide/Engine/Config"
"Haskell/Ide/Engine/Context"
"Haskell/Ide/Engine/Ghc"
"Haskell/Ide/Engine/GhcModuleCache"
"Haskell/Ide/Engine/Logger"
"Haskell/Ide/Engine/ModuleCache"
"Haskell/Ide/Engine/MonadFunctions"
"Haskell/Ide/Engine/MonadTypes"
"Haskell/Ide/Engine/MultiThreadState"
"Haskell/Ide/Engine/PluginApi"
"Haskell/Ide/Engine/PluginUtils"
"Haskell/Ide/Engine/PluginsIdeMonads"
"Haskell/Ide/Engine/TypeMap"
];
};
};
} // rec {
src = (pkgs.lib).mkDefault ./hie-plugin-api;
}

1
generated/8.6.5/stack-sha256 generated Normal file
View File

@ -0,0 +1 @@
0mvalnps5xnjg5qhr3kgl791fvxy8w1c3cki07kccps2ps9fhmj5

3
generated/8.8.3/materialization-id generated Normal file
View File

@ -0,0 +1,3 @@
These materialization files were generated with
haskell.nix af5998fe8d6b201d2a9be09993f1b9fae74e0082
haskell-ide-engine fe630a1e31232013549518909e511924e19af4af

View File

42
generated/8.8.3/materialized/default.nix generated Normal file
View File

@ -0,0 +1,42 @@
{
extras = hackage:
{
packages = {
"apply-refact" = (((hackage.apply-refact)."0.7.0.0").revisions).default;
"Cabal" = (((hackage.Cabal)."3.0.2.0").revisions).default;
"cabal-helper" = (((hackage.cabal-helper)."1.1.0.0").revisions).default;
"clock" = (((hackage.clock)."0.7.2").revisions).default;
"constrained-dynamic" = (((hackage.constrained-dynamic)."0.1.0.0").revisions).default;
"floskell" = (((hackage.floskell)."0.10.2").revisions).default;
"ghc-lib-parser" = (((hackage.ghc-lib-parser)."8.8.2.20200205").revisions).default;
"ghc-lib-parser-ex" = (((hackage.ghc-lib-parser-ex)."8.8.5.3").revisions).default;
"haddock-api" = (((hackage.haddock-api)."2.23.1").revisions).default;
"hoogle" = (((hackage.hoogle)."5.0.17.15").revisions).default;
"hsimport" = (((hackage.hsimport)."0.11.0").revisions).default;
"ilist" = (((hackage.ilist)."0.3.1.0").revisions).default;
"monad-dijkstra" = (((hackage.monad-dijkstra)."0.1.1.2").revisions).default;
"semigroups" = (((hackage.semigroups)."0.18.5").revisions).default;
"temporary" = (((hackage.temporary)."1.2.1.1").revisions).default;
"unliftio-core" = (((hackage.unliftio-core)."0.2.0.1").revisions).default;
"hie-bios" = (((hackage.hie-bios)."0.5.0").revisions).default;
"bytestring-trie" = (((hackage.bytestring-trie)."0.2.5.0").revisions).r1;
haskell-ide-engine = ./haskell-ide-engine.nix;
hie-plugin-api = ./hie-plugin-api.nix;
};
};
resolver = "lts-15.10";
modules = [
({ lib, ... }:
{
packages = {
"haskell-ide-engine" = {
flags = { "pedantic" = lib.mkOverride 900 true; };
};
"hie-plugin-api" = {
flags = { "pedantic" = lib.mkOverride 900 true; };
};
};
})
{ packages = {}; }
];
}

View File

@ -0,0 +1,358 @@
{ system
, compiler
, flags
, pkgs
, hsPkgs
, pkgconfPkgs
, errorHandler
, config
, ... }:
{
flags = { pedantic = false; };
package = {
specVersion = "2.0";
identifier = { name = "haskell-ide-engine"; version = "1.4"; };
license = "BSD-3-Clause";
copyright = "2015 - 2019, TBD";
maintainer = "alan.zimm@gmail.com (for now)";
author = "Many, TBD when we release";
homepage = "http://github.com/githubuser/haskell-ide-engine#readme";
url = "";
synopsis = "Provide a common engine to power any Haskell IDE";
description = "Please see README.md";
buildType = "Simple";
isLocal = true;
detailLevel = "FullDetails";
licenseFiles = [ "LICENSE" ];
dataDir = "";
dataFiles = [];
extraSrcFiles = [];
extraTmpFiles = [];
extraDocFiles = [];
};
components = {
"library" = {
depends = [
(hsPkgs."Cabal" or (errorHandler.buildDepError "Cabal"))
(hsPkgs."Diff" or (errorHandler.buildDepError "Diff"))
(hsPkgs."aeson" or (errorHandler.buildDepError "aeson"))
(hsPkgs."apply-refact" or (errorHandler.buildDepError "apply-refact"))
(hsPkgs."async" or (errorHandler.buildDepError "async"))
(hsPkgs."base" or (errorHandler.buildDepError "base"))
(hsPkgs."brittany" or (errorHandler.buildDepError "brittany"))
(hsPkgs."bytestring" or (errorHandler.buildDepError "bytestring"))
(hsPkgs."Cabal" or (errorHandler.buildDepError "Cabal"))
(hsPkgs."cabal-helper" or (errorHandler.buildDepError "cabal-helper"))
(hsPkgs."containers" or (errorHandler.buildDepError "containers"))
(hsPkgs."data-default" or (errorHandler.buildDepError "data-default"))
(hsPkgs."directory" or (errorHandler.buildDepError "directory"))
(hsPkgs."filepath" or (errorHandler.buildDepError "filepath"))
(hsPkgs."floskell" or (errorHandler.buildDepError "floskell"))
(hsPkgs."fold-debounce" or (errorHandler.buildDepError "fold-debounce"))
(hsPkgs."ghc" or (errorHandler.buildDepError "ghc"))
(hsPkgs."ghc-exactprint" or (errorHandler.buildDepError "ghc-exactprint"))
(hsPkgs."gitrev" or (errorHandler.buildDepError "gitrev"))
(hsPkgs."haddock-api" or (errorHandler.buildDepError "haddock-api"))
(hsPkgs."haddock-library" or (errorHandler.buildDepError "haddock-library"))
(hsPkgs."haskell-lsp" or (errorHandler.buildDepError "haskell-lsp"))
(hsPkgs."haskell-lsp-types" or (errorHandler.buildDepError "haskell-lsp-types"))
(hsPkgs."haskell-src-exts" or (errorHandler.buildDepError "haskell-src-exts"))
(hsPkgs."hie-plugin-api" or (errorHandler.buildDepError "hie-plugin-api"))
(hsPkgs."hoogle" or (errorHandler.buildDepError "hoogle"))
(hsPkgs."hsimport" or (errorHandler.buildDepError "hsimport"))
(hsPkgs."hslogger" or (errorHandler.buildDepError "hslogger"))
(hsPkgs."lifted-async" or (errorHandler.buildDepError "lifted-async"))
(hsPkgs."lens" or (errorHandler.buildDepError "lens"))
(hsPkgs."monoid-subclasses" or (errorHandler.buildDepError "monoid-subclasses"))
(hsPkgs."mtl" or (errorHandler.buildDepError "mtl"))
(hsPkgs."optparse-simple" or (errorHandler.buildDepError "optparse-simple"))
(hsPkgs."parsec" or (errorHandler.buildDepError "parsec"))
(hsPkgs."process" or (errorHandler.buildDepError "process"))
(hsPkgs."safe" or (errorHandler.buildDepError "safe"))
(hsPkgs."sorted-list" or (errorHandler.buildDepError "sorted-list"))
(hsPkgs."stm" or (errorHandler.buildDepError "stm"))
(hsPkgs."syb" or (errorHandler.buildDepError "syb"))
(hsPkgs."tagsoup" or (errorHandler.buildDepError "tagsoup"))
(hsPkgs."text" or (errorHandler.buildDepError "text"))
(hsPkgs."transformers" or (errorHandler.buildDepError "transformers"))
(hsPkgs."unix-time" or (errorHandler.buildDepError "unix-time"))
(hsPkgs."unordered-containers" or (errorHandler.buildDepError "unordered-containers"))
(hsPkgs."vector" or (errorHandler.buildDepError "vector"))
(hsPkgs."versions" or (errorHandler.buildDepError "versions"))
(hsPkgs."yaml" or (errorHandler.buildDepError "yaml"))
(hsPkgs."hie-bios" or (errorHandler.buildDepError "hie-bios"))
(hsPkgs."bytestring-trie" or (errorHandler.buildDepError "bytestring-trie"))
(hsPkgs."unliftio" or (errorHandler.buildDepError "unliftio"))
(hsPkgs."hlint" or (errorHandler.buildDepError "hlint"))
] ++ (pkgs.lib).optional (compiler.isGhc && (compiler.version).ge "8.6") (hsPkgs."ormolu" or (errorHandler.buildDepError "ormolu"));
buildable = true;
modules = [
"Paths_haskell_ide_engine"
"Haskell/Ide/Engine/Channel"
"Haskell/Ide/Engine/CodeActions"
"Haskell/Ide/Engine/Completions"
"Haskell/Ide/Engine/Reactor"
"Haskell/Ide/Engine/Options"
"Haskell/Ide/Engine/Plugin/ApplyRefact"
"Haskell/Ide/Engine/Plugin/Brittany"
"Haskell/Ide/Engine/Plugin/Example2"
"Haskell/Ide/Engine/Plugin/Floskell"
"Haskell/Ide/Engine/Plugin/Haddock"
"Haskell/Ide/Engine/Plugin/HfaAlign"
"Haskell/Ide/Engine/Plugin/HsImport"
"Haskell/Ide/Engine/Plugin/Liquid"
"Haskell/Ide/Engine/Plugin/Ormolu"
"Haskell/Ide/Engine/Plugin/Package"
"Haskell/Ide/Engine/Plugin/Package/Compat"
"Haskell/Ide/Engine/Plugin/Pragmas"
"Haskell/Ide/Engine/Plugin/Generic"
"Haskell/Ide/Engine/Plugin/GhcMod"
"Haskell/Ide/Engine/Scheduler"
"Haskell/Ide/Engine/Support/FromHaRe"
"Haskell/Ide/Engine/Support/Hoogle"
"Haskell/Ide/Engine/Support/Fuzzy"
"Haskell/Ide/Engine/Support/HieExtras"
"Haskell/Ide/Engine/Server"
"Haskell/Ide/Engine/Types"
"Haskell/Ide/Engine/Version"
];
hsSourceDirs = [ "src" ];
};
sublibs = {
"hie-test-utils" = {
depends = [
(hsPkgs."base" or (errorHandler.buildDepError "base"))
(hsPkgs."haskell-ide-engine" or (errorHandler.buildDepError "haskell-ide-engine"))
(hsPkgs."haskell-lsp" or (errorHandler.buildDepError "haskell-lsp"))
(hsPkgs."hie-bios" or (errorHandler.buildDepError "hie-bios"))
(hsPkgs."hie-plugin-api" or (errorHandler.buildDepError "hie-plugin-api"))
(hsPkgs."aeson" or (errorHandler.buildDepError "aeson"))
(hsPkgs."blaze-markup" or (errorHandler.buildDepError "blaze-markup"))
(hsPkgs."containers" or (errorHandler.buildDepError "containers"))
(hsPkgs."data-default" or (errorHandler.buildDepError "data-default"))
(hsPkgs."directory" or (errorHandler.buildDepError "directory"))
(hsPkgs."filepath" or (errorHandler.buildDepError "filepath"))
(hsPkgs."hslogger" or (errorHandler.buildDepError "hslogger"))
(hsPkgs."hspec" or (errorHandler.buildDepError "hspec"))
(hsPkgs."hspec-core" or (errorHandler.buildDepError "hspec-core"))
(hsPkgs."stm" or (errorHandler.buildDepError "stm"))
(hsPkgs."text" or (errorHandler.buildDepError "text"))
(hsPkgs."unordered-containers" or (errorHandler.buildDepError "unordered-containers"))
(hsPkgs."yaml" or (errorHandler.buildDepError "yaml"))
];
buildable = true;
modules = [ "TestUtils" ];
hsSourceDirs = [ "test/utils" ];
};
};
exes = {
"hie" = {
depends = [
(hsPkgs."base" or (errorHandler.buildDepError "base"))
(hsPkgs."containers" or (errorHandler.buildDepError "containers"))
(hsPkgs."data-default" or (errorHandler.buildDepError "data-default"))
(hsPkgs."directory" or (errorHandler.buildDepError "directory"))
(hsPkgs."filepath" or (errorHandler.buildDepError "filepath"))
(hsPkgs."ghc" or (errorHandler.buildDepError "ghc"))
(hsPkgs."hie-bios" or (errorHandler.buildDepError "hie-bios"))
(hsPkgs."haskell-ide-engine" or (errorHandler.buildDepError "haskell-ide-engine"))
(hsPkgs."haskell-lsp" or (errorHandler.buildDepError "haskell-lsp"))
(hsPkgs."haskell-lsp-types" or (errorHandler.buildDepError "haskell-lsp-types"))
(hsPkgs."hie-plugin-api" or (errorHandler.buildDepError "hie-plugin-api"))
(hsPkgs."hslogger" or (errorHandler.buildDepError "hslogger"))
(hsPkgs."optparse-simple" or (errorHandler.buildDepError "optparse-simple"))
(hsPkgs."stm" or (errorHandler.buildDepError "stm"))
(hsPkgs."text" or (errorHandler.buildDepError "text"))
(hsPkgs."yaml" or (errorHandler.buildDepError "yaml"))
];
buildable = true;
modules = [ "Paths_haskell_ide_engine" "RunTest" ];
hsSourceDirs = [ "app" ];
mainPath = [
"MainHie.hs"
] ++ (pkgs.lib).optional (flags.pedantic) "";
};
"hie-wrapper" = {
depends = [
(hsPkgs."base" or (errorHandler.buildDepError "base"))
(hsPkgs."directory" or (errorHandler.buildDepError "directory"))
(hsPkgs."filepath" or (errorHandler.buildDepError "filepath"))
(hsPkgs."hie-bios" or (errorHandler.buildDepError "hie-bios"))
(hsPkgs."haskell-ide-engine" or (errorHandler.buildDepError "haskell-ide-engine"))
(hsPkgs."haskell-lsp" or (errorHandler.buildDepError "haskell-lsp"))
(hsPkgs."hie-plugin-api" or (errorHandler.buildDepError "hie-plugin-api"))
(hsPkgs."hslogger" or (errorHandler.buildDepError "hslogger"))
(hsPkgs."optparse-simple" or (errorHandler.buildDepError "optparse-simple"))
(hsPkgs."process" or (errorHandler.buildDepError "process"))
];
buildable = true;
modules = [ "Paths_haskell_ide_engine" ];
hsSourceDirs = [ "app" ];
mainPath = [
"HieWrapper.hs"
] ++ (pkgs.lib).optional (flags.pedantic) "";
};
};
tests = {
"unit-test" = {
depends = [
(hsPkgs."QuickCheck" or (errorHandler.buildDepError "QuickCheck"))
(hsPkgs."aeson" or (errorHandler.buildDepError "aeson"))
(hsPkgs."cabal-helper" or (errorHandler.buildDepError "cabal-helper"))
(hsPkgs."ghc" or (errorHandler.buildDepError "ghc"))
(hsPkgs."base" or (errorHandler.buildDepError "base"))
(hsPkgs."bytestring" or (errorHandler.buildDepError "bytestring"))
(hsPkgs."containers" or (errorHandler.buildDepError "containers"))
(hsPkgs."directory" or (errorHandler.buildDepError "directory"))
(hsPkgs."filepath" or (errorHandler.buildDepError "filepath"))
(hsPkgs."free" or (errorHandler.buildDepError "free"))
(hsPkgs."ghc" or (errorHandler.buildDepError "ghc"))
(hsPkgs."haskell-ide-engine" or (errorHandler.buildDepError "haskell-ide-engine"))
(hsPkgs."haskell-lsp-types" or (errorHandler.buildDepError "haskell-lsp-types"))
(hsPkgs."hie-bios" or (errorHandler.buildDepError "hie-bios"))
(hsPkgs."hie-test-utils" or (errorHandler.buildDepError "hie-test-utils"))
(hsPkgs."hie-plugin-api" or (errorHandler.buildDepError "hie-plugin-api"))
(hsPkgs."hoogle" or (errorHandler.buildDepError "hoogle"))
(hsPkgs."hspec" or (errorHandler.buildDepError "hspec"))
(hsPkgs."optparse-applicative" or (errorHandler.buildDepError "optparse-applicative"))
(hsPkgs."process" or (errorHandler.buildDepError "process"))
(hsPkgs."quickcheck-instances" or (errorHandler.buildDepError "quickcheck-instances"))
(hsPkgs."text" or (errorHandler.buildDepError "text"))
(hsPkgs."unordered-containers" or (errorHandler.buildDepError "unordered-containers"))
];
build-tools = [
(hsPkgs.buildPackages.cabal-helper or (pkgs.buildPackages.cabal-helper or (errorHandler.buildToolDepError "cabal-helper")))
(hsPkgs.buildPackages.hspec-discover or (pkgs.buildPackages.hspec-discover or (errorHandler.buildToolDepError "hspec-discover")))
];
buildable = true;
modules = [
"ApplyRefactPluginSpec"
"CabalHelperSpec"
"CodeActionsSpec"
"ContextSpec"
"DiffSpec"
"ExtensibleStateSpec"
"GenericPluginSpec"
"GhcModPluginSpec"
"HooglePluginSpec"
"HsImportSpec"
"JsonSpec"
"LiquidSpec"
"OptionsSpec"
"PackagePluginSpec"
"Paths_haskell_ide_engine"
"Spec"
];
hsSourceDirs = [ "test/unit" ];
mainPath = [ "Main.hs" ];
};
"dispatcher-test" = {
depends = [
(hsPkgs."base" or (errorHandler.buildDepError "base"))
(hsPkgs."aeson" or (errorHandler.buildDepError "aeson"))
(hsPkgs."data-default" or (errorHandler.buildDepError "data-default"))
(hsPkgs."directory" or (errorHandler.buildDepError "directory"))
(hsPkgs."filepath" or (errorHandler.buildDepError "filepath"))
(hsPkgs."ghc" or (errorHandler.buildDepError "ghc"))
(hsPkgs."haskell-ide-engine" or (errorHandler.buildDepError "haskell-ide-engine"))
(hsPkgs."haskell-lsp-types" or (errorHandler.buildDepError "haskell-lsp-types"))
(hsPkgs."hie-test-utils" or (errorHandler.buildDepError "hie-test-utils"))
(hsPkgs."hie-plugin-api" or (errorHandler.buildDepError "hie-plugin-api"))
(hsPkgs."hspec" or (errorHandler.buildDepError "hspec"))
(hsPkgs."stm" or (errorHandler.buildDepError "stm"))
(hsPkgs."text" or (errorHandler.buildDepError "text"))
(hsPkgs."unordered-containers" or (errorHandler.buildDepError "unordered-containers"))
];
build-tools = [
(hsPkgs.buildPackages.hspec-discover or (pkgs.buildPackages.hspec-discover or (errorHandler.buildToolDepError "hspec-discover")))
];
buildable = true;
hsSourceDirs = [ "test/dispatcher" ];
mainPath = [ "Main.hs" ];
};
"plugin-dispatcher-test" = {
depends = [
(hsPkgs."base" or (errorHandler.buildDepError "base"))
(hsPkgs."data-default" or (errorHandler.buildDepError "data-default"))
(hsPkgs."directory" or (errorHandler.buildDepError "directory"))
(hsPkgs."filepath" or (errorHandler.buildDepError "filepath"))
(hsPkgs."haskell-ide-engine" or (errorHandler.buildDepError "haskell-ide-engine"))
(hsPkgs."haskell-lsp-types" or (errorHandler.buildDepError "haskell-lsp-types"))
(hsPkgs."hie-plugin-api" or (errorHandler.buildDepError "hie-plugin-api"))
(hsPkgs."hie-test-utils" or (errorHandler.buildDepError "hie-test-utils"))
(hsPkgs."hspec" or (errorHandler.buildDepError "hspec"))
(hsPkgs."stm" or (errorHandler.buildDepError "stm"))
(hsPkgs."text" or (errorHandler.buildDepError "text"))
];
buildable = true;
hsSourceDirs = [ "test/plugin-dispatcher" ];
mainPath = [ "Main.hs" ];
};
"func-test" = {
depends = [
(hsPkgs."aeson" or (errorHandler.buildDepError "aeson"))
(hsPkgs."base" or (errorHandler.buildDepError "base"))
(hsPkgs."data-default" or (errorHandler.buildDepError "data-default"))
(hsPkgs."directory" or (errorHandler.buildDepError "directory"))
(hsPkgs."filepath" or (errorHandler.buildDepError "filepath"))
(hsPkgs."lsp-test" or (errorHandler.buildDepError "lsp-test"))
(hsPkgs."haskell-ide-engine" or (errorHandler.buildDepError "haskell-ide-engine"))
(hsPkgs."haskell-lsp-types" or (errorHandler.buildDepError "haskell-lsp-types"))
(hsPkgs."haskell-lsp" or (errorHandler.buildDepError "haskell-lsp"))
(hsPkgs."hie-test-utils" or (errorHandler.buildDepError "hie-test-utils"))
(hsPkgs."hie-plugin-api" or (errorHandler.buildDepError "hie-plugin-api"))
(hsPkgs."hspec" or (errorHandler.buildDepError "hspec"))
(hsPkgs."lens" or (errorHandler.buildDepError "lens"))
(hsPkgs."text" or (errorHandler.buildDepError "text"))
(hsPkgs."unordered-containers" or (errorHandler.buildDepError "unordered-containers"))
(hsPkgs."containers" or (errorHandler.buildDepError "containers"))
];
build-tools = [
(hsPkgs.buildPackages.hspec-discover or (pkgs.buildPackages.hspec-discover or (errorHandler.buildToolDepError "hspec-discover")))
(hsPkgs.buildPackages.haskell-ide-engine or (pkgs.buildPackages.haskell-ide-engine or (errorHandler.buildToolDepError "haskell-ide-engine")))
(hsPkgs.buildPackages.cabal-helper or (pkgs.buildPackages.cabal-helper or (errorHandler.buildToolDepError "cabal-helper")))
];
buildable = true;
modules = [
"CompletionSpec"
"CommandSpec"
"DeferredSpec"
"DefinitionSpec"
"DiagnosticsSpec"
"FormatSpec"
"FunctionalBadProjectSpec"
"FunctionalCodeActionsSpec"
"FunctionalLiquidSpec"
"FunctionalSpec"
"HieBiosSpec"
"HighlightSpec"
"HoverSpec"
"ProgressSpec"
"ReferencesSpec"
"RenameSpec"
"SymbolsSpec"
"TypeDefinitionSpec"
"Utils"
];
hsSourceDirs = [ "test/functional" ];
mainPath = [ "Main.hs" ];
};
"wrapper-test" = {
depends = [
(hsPkgs."base" or (errorHandler.buildDepError "base"))
(hsPkgs."hspec" or (errorHandler.buildDepError "hspec"))
(hsPkgs."directory" or (errorHandler.buildDepError "directory"))
(hsPkgs."filepath" or (errorHandler.buildDepError "filepath"))
(hsPkgs."process" or (errorHandler.buildDepError "process"))
(hsPkgs."haskell-ide-engine" or (errorHandler.buildDepError "haskell-ide-engine"))
(hsPkgs."hie-plugin-api" or (errorHandler.buildDepError "hie-plugin-api"))
];
buildable = true;
hsSourceDirs = [ "test/wrapper" ];
mainPath = [ "HieWrapper.hs" ];
};
};
};
} // rec {
src = (pkgs.lib).mkDefault ./.;
}

View File

@ -0,0 +1,95 @@
{ system
, compiler
, flags
, pkgs
, hsPkgs
, pkgconfPkgs
, errorHandler
, config
, ... }:
{
flags = { pedantic = false; };
package = {
specVersion = "2.0";
identifier = { name = "hie-plugin-api"; version = "1.4"; };
license = "BSD-3-Clause";
copyright = "2015 TBD";
maintainer = "alan.zimm@gmail.com (for now)";
author = "Many,TBD when we release";
homepage = "";
url = "";
synopsis = "Haskell IDE API for plugin communication";
description = "Please see README.md";
buildType = "Simple";
isLocal = true;
detailLevel = "FullDetails";
licenseFiles = [ "LICENSE" ];
dataDir = "";
dataFiles = [];
extraSrcFiles = [];
extraTmpFiles = [];
extraDocFiles = [];
};
components = {
"library" = {
depends = [
(hsPkgs."base" or (errorHandler.buildDepError "base"))
(hsPkgs."Diff" or (errorHandler.buildDepError "Diff"))
(hsPkgs."aeson" or (errorHandler.buildDepError "aeson"))
(hsPkgs."bytestring-trie" or (errorHandler.buildDepError "bytestring-trie"))
(hsPkgs."bytestring" or (errorHandler.buildDepError "bytestring"))
(hsPkgs."cryptohash-sha1" or (errorHandler.buildDepError "cryptohash-sha1"))
(hsPkgs."constrained-dynamic" or (errorHandler.buildDepError "constrained-dynamic"))
(hsPkgs."containers" or (errorHandler.buildDepError "containers"))
(hsPkgs."data-default" or (errorHandler.buildDepError "data-default"))
(hsPkgs."directory" or (errorHandler.buildDepError "directory"))
(hsPkgs."filepath" or (errorHandler.buildDepError "filepath"))
(hsPkgs."fingertree" or (errorHandler.buildDepError "fingertree"))
(hsPkgs."free" or (errorHandler.buildDepError "free"))
(hsPkgs."ghc" or (errorHandler.buildDepError "ghc"))
(hsPkgs."hie-bios" or (errorHandler.buildDepError "hie-bios"))
(hsPkgs."cabal-helper" or (errorHandler.buildDepError "cabal-helper"))
(hsPkgs."haskell-lsp" or (errorHandler.buildDepError "haskell-lsp"))
(hsPkgs."hslogger" or (errorHandler.buildDepError "hslogger"))
(hsPkgs."unliftio" or (errorHandler.buildDepError "unliftio"))
(hsPkgs."unliftio-core" or (errorHandler.buildDepError "unliftio-core"))
(hsPkgs."monad-control" or (errorHandler.buildDepError "monad-control"))
(hsPkgs."mtl" or (errorHandler.buildDepError "mtl"))
(hsPkgs."process" or (errorHandler.buildDepError "process"))
(hsPkgs."sorted-list" or (errorHandler.buildDepError "sorted-list"))
(hsPkgs."stm" or (errorHandler.buildDepError "stm"))
(hsPkgs."syb" or (errorHandler.buildDepError "syb"))
(hsPkgs."text" or (errorHandler.buildDepError "text"))
(hsPkgs."transformers" or (errorHandler.buildDepError "transformers"))
(hsPkgs."unordered-containers" or (errorHandler.buildDepError "unordered-containers"))
(hsPkgs."transformers-base" or (errorHandler.buildDepError "transformers-base"))
(hsPkgs."yaml" or (errorHandler.buildDepError "yaml"))
] ++ (if system.isWindows
then [ (hsPkgs."Win32" or (errorHandler.buildDepError "Win32")) ]
else [ (hsPkgs."unix" or (errorHandler.buildDepError "unix")) ]);
buildable = true;
modules = [
"Haskell/Ide/Engine/ArtifactMap"
"Haskell/Ide/Engine/Compat"
"Haskell/Ide/Engine/Cradle"
"Haskell/Ide/Engine/GhcCompat"
"Haskell/Ide/Engine/GhcUtils"
"Haskell/Ide/Engine/Config"
"Haskell/Ide/Engine/Context"
"Haskell/Ide/Engine/Ghc"
"Haskell/Ide/Engine/GhcModuleCache"
"Haskell/Ide/Engine/Logger"
"Haskell/Ide/Engine/ModuleCache"
"Haskell/Ide/Engine/MonadFunctions"
"Haskell/Ide/Engine/MonadTypes"
"Haskell/Ide/Engine/MultiThreadState"
"Haskell/Ide/Engine/PluginApi"
"Haskell/Ide/Engine/PluginUtils"
"Haskell/Ide/Engine/PluginsIdeMonads"
"Haskell/Ide/Engine/TypeMap"
];
};
};
} // rec {
src = (pkgs.lib).mkDefault ./hie-plugin-api;
}

1
generated/8.8.3/stack-sha256 generated Normal file
View File

@ -0,0 +1 @@
0fd2gzgg626r718l21bmgs689wy0x9b9690mp7sdx99jp1bjpd77

View File

@ -1 +0,0 @@
Cabal-2.2.0.1 array-0.5.2.0 base-4.11.1.0 binary-0.8.5.1 bytestring-0.10.8.2 containers-0.5.11.0 deepseq-1.4.3.0 directory-1.3.1.5 filepath-1.4.2 ghc-8.4.4 ghc-boot-8.4.4 ghc-boot-th-8.4.4 ghc-compact-0.1.0.0 ghc-prim-0.5.2.0 ghci-8.4.4 haskeline-0.7.4.2 hpc-0.6.0.3 integer-gmp-1.0.2.0 mtl-2.2.2 parsec-3.1.13.0 pretty-1.1.3.6 process-1.6.3.0 rts-1.0 stm-2.4.5.1 template-haskell-2.13.0.0 terminfo-0.4.1.1 text-1.2.3.1 time-1.8.0.2 transformers-0.5.5.0 unix-2.7.2.2 xhtml-3000.2.2.1

View File

@ -1 +0,0 @@
Cabal-2.2.0.1 array-0.5.2.0 base-4.11.1.0 binary-0.8.5.1 bytestring-0.10.8.2 containers-0.5.11.0 deepseq-1.4.3.0 directory-1.3.1.5 filepath-1.4.2 ghc-8.4.4 ghc-boot-8.4.4 ghc-boot-th-8.4.4 ghc-compact-0.1.0.0 ghc-prim-0.5.2.0 ghci-8.4.4 haskeline-0.7.4.2 hpc-0.6.0.3 integer-gmp-1.0.2.0 mtl-2.2.2 parsec-3.1.13.0 pretty-1.1.3.6 process-1.6.3.0 rts-1.0 stm-2.4.5.1 template-haskell-2.13.0.0 terminfo-0.4.1.1 text-1.2.3.1 time-1.8.0.2 transformers-0.5.5.0 unix-2.7.2.2 xhtml-3000.2.2.1

View File

@ -1 +0,0 @@
Cabal-2.2.0.1 array-0.5.2.0 base-4.11.1.0 binary-0.8.5.1 bytestring-0.10.8.2 containers-0.5.11.0 deepseq-1.4.3.0 directory-1.3.1.5 filepath-1.4.2 ghc-8.4.4 ghc-boot-8.4.4 ghc-boot-th-8.4.4 ghc-compact-0.1.0.0 ghc-prim-0.5.2.0 ghci-8.4.4 haskeline-0.7.4.2 hpc-0.6.0.3 integer-gmp-1.0.2.0 mtl-2.2.2 parsec-3.1.13.0 pretty-1.1.3.6 process-1.6.3.0 rts-1.0 stm-2.4.5.1 template-haskell-2.13.0.0 terminfo-0.4.1.1 text-1.2.3.1 time-1.8.0.2 transformers-0.5.5.0 unix-2.7.2.2 xhtml-3000.2.2.1

View File

@ -1 +0,0 @@
Cabal-2.4.0.1 array-0.5.2.0 base-4.12.0.0 binary-0.8.6.0 bytestring-0.10.8.2 containers-0.6.0.1 deepseq-1.4.4.0 directory-1.3.3.0 filepath-1.4.2.1 ghc-8.6.1 ghc-boot-8.6.1 ghc-boot-th-8.6.1 ghc-compact-0.1.0.0 ghc-heap-8.6.1 ghc-prim-0.5.3 ghci-8.6.1 haskeline-0.7.4.3 hpc-0.6.0.3 integer-gmp-1.0.2.0 libiserv-8.6.1 mtl-2.2.2 parsec-3.1.13.0 pretty-1.1.3.6 process-1.6.3.0 rts-1.0 stm-2.5.0.0 template-haskell-2.14.0.0 terminfo-0.4.1.2 text-1.2.3.1 time-1.8.0.2 transformers-0.5.5.0 unix-2.7.2.2 xhtml-3000.2.2.1

View File

@ -1 +0,0 @@
Cabal-2.4.0.1 array-0.5.2.0 base-4.12.0.0 binary-0.8.6.0 bytestring-0.10.8.2 containers-0.6.0.1 deepseq-1.4.4.0 directory-1.3.3.0 filepath-1.4.2.1 ghc-8.6.1 ghc-boot-8.6.1 ghc-boot-th-8.6.1 ghc-compact-0.1.0.0 ghc-heap-8.6.1 ghc-prim-0.5.3 ghci-8.6.1 haskeline-0.7.4.3 hpc-0.6.0.3 integer-gmp-1.0.2.0 libiserv-8.6.1 mtl-2.2.2 parsec-3.1.13.0 pretty-1.1.3.6 process-1.6.3.0 rts-1.0 stm-2.5.0.0 template-haskell-2.14.0.0 terminfo-0.4.1.2 text-1.2.3.1 time-1.8.0.2 transformers-0.5.5.0 unix-2.7.2.2 xhtml-3000.2.2.1

View File

@ -1 +0,0 @@
Cabal-3.0.0.0 array-0.5.4.0 base-4.13.0.0 binary-0.8.7.0 bytestring-0.10.9.0 containers-0.6.2.1 deepseq-1.4.4.0 directory-1.3.3.2 filepath-1.4.2.1 ghc-8.8.1 ghc-boot-8.8.1 ghc-boot-th-8.8.1 ghc-compact-0.1.0.0 ghc-heap-8.8.1 ghc-prim-0.5.3 ghci-8.8.1 haskeline-0.7.5.0 hpc-0.6.0.3 integer-gmp-1.0.2.0 libiserv-8.8.1 mtl-2.2.2 parsec-3.1.14.0 pretty-1.1.3.6 process-1.6.5.1 rts-1.0 stm-2.5.0.0 template-haskell-2.15.0.0 terminfo-0.4.1.4 text-1.2.4.0 time-1.9.3 transformers-0.5.6.2 unix-2.7.2.2 xhtml-3000.2.2.1

View File

@ -1 +0,0 @@
Cabal-3.0.0.0 array-0.5.4.0 base-4.13.0.0 binary-0.8.7.0 bytestring-0.10.9.0 containers-0.6.2.1 deepseq-1.4.4.0 directory-1.3.3.2 filepath-1.4.2.1 ghc-8.8.1 ghc-boot-8.8.1 ghc-boot-th-8.8.1 ghc-compact-0.1.0.0 ghc-heap-8.8.1 ghc-prim-0.5.3 ghci-8.8.1 haskeline-0.7.5.0 hpc-0.6.0.3 integer-gmp-1.0.2.0 libiserv-8.8.1 mtl-2.2.2 parsec-3.1.14.0 pretty-1.1.3.6 process-1.6.5.1 rts-1.0 stm-2.5.0.0 template-haskell-2.15.0.0 terminfo-0.4.1.4 text-1.2.4.0 time-1.9.3 transformers-0.5.6.2 unix-2.7.2.2 xhtml-3000.2.2.1

View File

@ -1 +0,0 @@
0rxjkfiq53ibz0rzggvnp341b6kgzgfr9x6q07m2my7ijlirs2da

View File

@ -1 +0,0 @@
195rzph1jfrbccky5m2wvm6d0x0v0zy6iq630wrlbl1dx7jrji37

View File

@ -1 +0,0 @@
1bs84r8mbxs9bkkbl0vsazwrc77gvfc140kn8rknh4vhqshmjb15

View File

@ -1 +0,0 @@
1b5wix9kr5s3hscpl425si0zw00zzijc9xrcph6l2myh4n5nvcm0

View File

@ -1 +0,0 @@
0j4m572dz6ak49mf3c0q4aq1z0qzm7qn08amygym27j55gh197zf

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@ -1 +0,0 @@
1.1

1
generated/unstable generated
View File

@ -1 +0,0 @@
stable

View File

@ -1,4 +0,0 @@
import (fetchTarball {
url = "https://github.com/NixOS/nixpkgs/tarball/acbdaa569f4ee387386ebe1b9e60b9f95b4ab21b";
sha256 = "0xzyghyxk3hwhicgdbi8yv8b8ijy1rgdsj5wb26y5j322v96zlpz";
}) {}

View File

@ -1 +0,0 @@
c47ac0d8bf43543d8dcef4895167dd1f7af9d968

View File

@ -1 +0,0 @@
4708d3f84bce8c6bec0d989df1b33c59beb97821

View File

@ -1 +0,0 @@
91ca88b3e6b4d57640c213e755077b2d93d0a8bd

View File

@ -1 +0,0 @@
b5c02d2028dbfe33f05a6134a7190af74d792b74

View File

@ -1 +0,0 @@
d73f16d6767e99675682f822dac3017bf9af1e83

View File

@ -1 +0,0 @@
9b3e5a3aab728e7cea2da12b6db300136604be3a

View File

@ -1 +0,0 @@
9b3e5a3aab728e7cea2da12b6db300136604be3a

View File

@ -1 +0,0 @@
106db715f9d7b2c2a87e2142ebefa77d7231214f

View File

@ -1 +0,0 @@
d73f16d6767e99675682f822dac3017bf9af1e83

View File

@ -1 +0,0 @@
650a295621b27c4ebe0fa64a63fd25323e64deb3

View File

@ -1 +0,0 @@
f77e057cda60a3f96a4010a698ff3be311bf18c6

View File

@ -1 +0,0 @@
f77e057cda60a3f96a4010a698ff3be311bf18c6

37
overlay.nix Normal file
View File

@ -0,0 +1,37 @@
let
build = import ./build.nix;
in final: prev:
let
glibcName =
if final.stdenv.hostPlatform.isDarwin
# glibc matching doesn't matter for darwin
then "glibc-2.30"
else final.glibc.name;
in {
haskell = prev.haskell // {
packageOverrides = final.lib.composeExtensions prev.haskell.packageOverrides
(hfinal: hprev: {
hie = (build {
inherit glibcName;
ghcVersion = hfinal.ghc.version;
}).combined;
});
};
}
# Only include this part if a haskell-nix overlay is there
// prev.lib.optionalAttrs (prev ? haskell-nix) {
haskell-nix = prev.haskell-nix // {
custom-tools = prev.haskell-nix.custom-tools // {
hie.unstable = args: (build {
inherit glibcName;
ghcVersion = if args ? compiler-nix-name
then final.haskell-nix.compiler.${args.compiler-nix-name}.version
else args.ghc.version; # deprecated
}).combined;
};
};
}

View File

@ -1,9 +0,0 @@
self: super: {
Cabal = null;
hsimport = super.hsimport.overrideAttrs (old: {
# See https://github.com/NixOS/nixpkgs/pull/42224
# https://github.com/NixOS/nixpkgs/commit/f8a158c3466
# Necessary because ghc842 uses an older nixpkgs version
configureFlags = [ "--libsubdir=$abi/$libname" ];
});
}

View File

@ -1,3 +0,0 @@
self: super: {
Cabal = null;
}

View File

@ -1,3 +0,0 @@
self: super: {
Cabal = null;
}

View File

@ -1 +0,0 @@
(import ./update.nix {}).env

35
sources.nix Normal file
View File

@ -0,0 +1,35 @@
let
haskellNixVersion = "af5998fe8d6b201d2a9be09993f1b9fae74e0082";
haskellNixSrc = fetchTarball {
url = "https://github.com/input-output-hk/haskell.nix/tarball/${haskellNixVersion}";
sha256 = "0z5w99wkkpg2disvwjnsyp45w0bhdkrhvnrpz5nbwhhp21c71mbn";
};
haskellNix = import haskellNixSrc {};
glibcSpecificPkgs = {
"glibc-2.30" = import haskellNix.sources.nixpkgs-2003 haskellNix.nixpkgsArgs;
"glibc-2.27" = import haskellNix.sources.nixpkgs-1909 haskellNix.nixpkgsArgs;
};
pkgs = glibcSpecificPkgs."glibc-2.30";
hie = rec {
# unstable-2020-05-23
version = "fe630a1e31232013549518909e511924e19af4af";
src = fetchTarball {
url = "https://github.com/haskell/haskell-ide-engine/archive/${version}.tar.gz";
sha256 = "1lbbzk9kj39h79wb8imv5s22y592cyyrk06y24glrcxh5bzghb9l";
};
};
# String gets written to the generated directory, so CI can quickly know
# whether materialization files need to be updated
materializationId = builtins.toFile "materialization-id" ''
These materialization files were generated with
haskell.nix ${haskellNixVersion}
haskell-ide-engine ${hie.version}
'';
in {
inherit glibcSpecificPkgs pkgs hie materializationId;
}

View File

@ -1,46 +0,0 @@
module Cache
( get
, getLocal
, Expires(..)
, Key
, Value
) where
import Control.Monad.IO.Class
import qualified Data.ByteString.Lazy.Char8 as BS
import Data.Time
import System.Directory
import System.FilePath
type Key = FilePath
type Value = BS.ByteString
data Expires = ExpiresNever
| ExpiresAfter NominalDiffTime
get :: MonadIO m => Expires -> Key -> m Value -> m Value
get expires key generator = do
path <- liftIO $ (</> key) <$> getXdgDirectory XdgCache "all-hies"
getWithBase expires path generator
getLocal :: MonadIO m => Expires -> Key -> m Value -> m Value
getLocal expires key generator = do
path <- liftIO $ (</> key) <$> getCurrentDirectory
getWithBase expires path generator
getWithBase :: MonadIO m => Expires -> FilePath -> m Value -> m Value
getWithBase expires path generator = do
exists <- liftIO $ doesFileExist path
needsRefresh <- if exists then case expires of
ExpiresNever -> return False
ExpiresAfter seconds -> do
now <- liftIO getCurrentTime
modTime <- liftIO $ getModificationTime path
return $ now `diffUTCTime` modTime > seconds
else return True
if needsRefresh then do
contents <- generator
liftIO $ createDirectoryIfMissing True (takeDirectory path)
liftIO $ BS.writeFile path contents
return contents
else liftIO $ BS.readFile path

View File

@ -1,313 +0,0 @@
{-# LANGUAGE NamedFieldPuns #-}
{-# LANGUAGE OverloadedStrings #-}
{-# LANGUAGE ViewPatterns #-}
import Control.Exception (handleJust)
import Control.Monad.Reader
import Data.Aeson (decode)
import qualified Data.ByteString.Lazy.Char8 as BS
import Data.Char (isDigit, isHexDigit)
import Data.List (intercalate, isPrefixOf, sortOn)
import Data.Maybe
import Data.Ord (Down(..))
import Data.Time
import Distribution.System (Arch (..), OS (..), Platform (..))
import Network.HTTP.Client
import Network.HTTP.Client.TLS
import Stack2nix
import System.Console.Haskeline hiding (getHistory)
import System.Directory
import System.Environment (getArgs, setEnv)
import System.Exit (ExitCode (..))
import System.FilePath
import System.IO (hClose)
import System.IO.Temp
import System.Process
import Text.Regex.Applicative
import qualified Cache
import Options
data Env = Env
{ cacheDir :: FilePath
, manager :: Manager
, opts :: Options
}
-- | Initializes the read-only environment
getEnv :: IO Env
getEnv = Env
<$> getXdgDirectory XdgCache "all-hies"
<*> newTlsManager
<*> getOptions
type App = InputT (ReaderT Env IO)
hie :: App Repository
hie = lift $ asks $ Repository . optRepo . opts
main :: IO ()
main = do
env <- getEnv
runReaderT (runInputT haskelineSettings run) env
where haskelineSettings = defaultSettings { historyFile = Nothing }
run :: App ()
run = do
updateRepo nixpkgs
repoPath nixpkgs >>= \path -> liftIO $ setEnv "NIX_PATH" ("nixpkgs=" ++ path)
name <- lift $ asks (optName . opts)
rev <- lift $ asks (optRev . opts)
regenerate ("generated" </> name) rev
cleanGenerated :: FilePath -> App ()
cleanGenerated root = do
cleanDirectory root
liftIO $ createDirectory (root </> "nixpkgsHashes")
liftIO $ createDirectory (root </> "ghcBaseLibraries")
liftIO $ createDirectory (root </> "stack2nix")
-- | Makes sure that the given directory is existent and empty
cleanDirectory :: FilePath -> App ()
cleanDirectory path = liftIO $ do
liftIO $ putStrLn $ "Cleaning directory " ++ path
exists <- doesPathExist path
when exists $ removeDirectoryRecursive path
createDirectoryIfMissing True path
-- | Returns the newest tag in the given repository
latestTag :: Repository -> App String
latestTag repo = do
-- TODO: Use git ls-remote --tags --sort=creatordate --refs instead?
tags <- lines <$> git repo [ "tag", "--sort", "creatordate" ]
return $ last tags
-- | Returns the git hash for a specified revision in the given repository
revHash :: Repository -> String -> App (String, String)
revHash (Repository url) rev = do
result <- liftIO $ lines <$> readProcess "git" [ "ls-remote", url, rev ] ""
case result of
[] -> fail $ "No such revision: " ++ rev
line:_ -> return (hash, ref) where
[hash, ref] = words line
-- | A call to stack2nix for generating a haskell-ide-engine expression at a specified path, for a specific revision and ghc version
callStack2nix :: String -> Version -> App BS.ByteString
callStack2nix rev version = do
Repository repo <- hie
liftIO $ putStrLn $ "Running stack2nix for hie revision " ++ rev ++ " and ghc version " ++ show version
liftIO $ withSystemTempFile "all-hies-stack2nix" $ \path handle -> do
hClose handle
handleJust (\e -> if e == ExitSuccess then Just () else Nothing) return $
stack2nix Args
{ argRev = Just rev
, argOutFile = Just path
, argStackYaml = "stack-" ++ show version ++ ".yaml"
, argThreads = 4
, argTest = False
, argBench = False
, argHaddock = False
, argHackageSnapshot = Nothing
, argPlatform = Platform X86_64 Linux
, argUri = repo
, argIndent = True
, argVerbose = False
}
BS.readFile path
-- | Generate the stack2nix file for the specified HIE git hash and ghc version
genS2N :: FilePath -> String -> Version -> App BS.ByteString
genS2N root hash version = do
nixpkgsRev <- findNixpkgsForGhc version
sha <- nixpkgsSha nixpkgsRev
liftIO $ writeFile (root </> "nixpkgsHashes" </> nixpkgsRev) sha
genBaseLibraries root version nixpkgsRev
Cache.get Cache.ExpiresNever ("per-hie" </> hash </> nixVersion version <.> ".nix") $ do
liftIO $ putStrLn $ "Using nixpkgs revision " ++ nixpkgsRev ++ " for ghc version " ++ show version
git nixpkgs [ "checkout", nixpkgsRev ]
callStack2nix hash version
genBaseLibraries :: FilePath -> Version -> String -> App ()
genBaseLibraries root version@(Version major minor patch) nixpkgsRev = do
contents <- Cache.get Cache.ExpiresNever ("per-ghcMinor" </> show major ++ show minor) $ do
git nixpkgs [ "checkout", nixpkgsRev ]
let -- Arguments to set config and overlays to nothing so
-- that they aren't sourced from the user's configuration
-- files in ~/.config/nixpkgs
purePkgs = [ "--arg", "config", "{}", "--arg", "overlays", "[]" ]
ghcPath <- liftIO $ init <$> readProcess "nix-build"
([ "--no-out-link", "<nixpkgs>", "-A", "haskell.compiler." ++ nixVersion version ] ++ purePkgs) ""
libs <- liftIO $ readProcess (ghcPath </> "bin/ghc-pkg")
[ "list", "--no-user-package-db", "--simple" ] ""
return $ BS.pack libs
liftIO $ BS.writeFile (root </> "ghcBaseLibraries" </> nixVersion version) contents
nixpkgsSha :: String -> App String
nixpkgsSha revision = do
hash <- Cache.get Cache.ExpiresNever ("per-nixpkgs/sha256" </> revision) $ do
git nixpkgs [ "checkout", revision ]
path <- repoPath nixpkgs
-- tmp needs to be next to nixpkgs itself (same file system), such that hardlinking works, which makes it very efficient
tmpCache <- lift $ (</> "tmp") <$> asks cacheDir
liftIO $ createDirectoryIfMissing True tmpCache
liftIO $ withTempDirectory tmpCache "all-hies-nixpkgs-sha256" $ \tmp -> do
liftIO $ readProcess "cp" ["-Trl", path, tmp] ""
liftIO $ removeDirectoryRecursive (tmp </> ".git")
hash <- liftIO $ head . lines <$> readProcess "nix-hash" ["--type", "sha256", "--base32", tmp] ""
return $ BS.pack hash
return $ BS.unpack hash
-- | Finds a suitable nixpkgs revision that has a the specified compiler available
findNixpkgsForGhc :: Version -> App String
findNixpkgsForGhc version = do
contents <- Cache.getLocal Cache.ExpiresNever ("nixpkgsForGhc" </> nixVersion version) $ do
hist <- getHistory
revision <- go hist
return $ BS.pack revision
return $ BS.unpack contents
where
go :: Hist -> App String
go [] = fail $ "Couldn't find a nixpkgs for ghc version " ++ show version
go (h:hist) = do
versions <- ghcVersionsForNixpkgs h
if version `elem` versions
then return h else go hist
-- | Determines the available GHC versions for a nixpkgs revision
ghcVersionsForNixpkgs :: String -> App [Version]
ghcVersionsForNixpkgs rev = do
contents <- Cache.get Cache.ExpiresNever ("per-nixpkgs/ghcVersions" </> rev) $ do
git nixpkgs [ "checkout", rev ]
nixpkgs <- repoPath nixpkgs
stdout <- liftIO $ readProcess "nix-instantiate" [ "--eval", "--json", "-" ]
("builtins.attrNames (import " ++ nixpkgs ++ " {}).haskell.compiler")
case decode (BS.pack stdout) :: Maybe [String] of
Nothing -> fail $ "Failed to decode nix output: " ++ stdout
Just versions' -> do
let versions = mapMaybe (nixVersionRegex `match`) versions'
return $ BS.pack $ unlines $ map show versions
return $ mapMaybe (versionRegex `match`) . lines $ BS.unpack contents
-- | Regenerate the specified HIE revision stack2nix files in the given path
regenerate :: FilePath -> String -> App ()
regenerate root revision = do
liftIO $ putStrLn $ "Regenerating " ++ root ++ " with revision " ++ revision
cleanGenerated root
hieRepo <- hie
(hash, ref) <- revHash hieRepo revision
let revName = if "refs/heads/" `isPrefixOf` ref
then take 10 hash else revision
liftIO $ putStrLn $ "Regenerating for revision " ++ revName ++ " (" ++ hash ++ ")"
liftIO $ putStrLn $ "Writing " ++ revName ++ " to " ++ root ++ "stack2nix/revision"
liftIO $ writeFile (root </> "stack2nix/revision") revName
files <- listRepoFiles hieRepo
let versions = sortOn Down (mapMaybe (stackPathRegex `match`) files)
liftIO $ putStrLn $ "HIE " ++ revName ++ " has ghc versions " ++ intercalate ", " (map show versions)
forM_ versions $ \version -> do
contents <- genS2N root hash version
liftIO $ BS.writeFile (root </> "stack2nix" </> nixVersion version <.> "nix") contents
listRepoFiles :: Repository -> App [FilePath]
listRepoFiles (Repository repo) = liftIO $ withSystemTempDirectory "all-hies-repo" $ \tmpDir -> do
readProcess "git" [ "clone", repo, tmpDir ] ""
listDirectory tmpDir
newtype Repository = Repository String
nixpkgs :: Repository
nixpkgs = Repository "https://github.com/NixOS/nixpkgs"
-- | Returns the local checkout path to a repository
repoPath :: Repository -> App FilePath
repoPath (Repository (takeFileName -> name)) = lift $ (</> name) <$> asks cacheDir
-- | Runs git with the specified arguments in the given repositories local checkout
git :: Repository -> [String] -> App String
git repo args = do
path <- repoPath repo
let allArgs = "-C":path:args
liftIO $ putStrLn $ "Running git " ++ unwords allArgs
liftIO $ readProcess "git" allArgs ""
-- | Ensures that the repository repo is cloned to its path with the latest updates fetched
updateRepo :: Repository -> App ()
updateRepo repo@(Repository url@(takeFileName -> name)) = do
path <- repoPath repo
exists <- liftIO $ doesPathExist path
if exists then do
git repo [ "clean", "-fd" ]
git repo [ "reset", "--hard", "HEAD" ]
git repo [ "fetch", "origin" ]
else do
candidate <- (\home -> home </> "src" </> name) <$> liftIO getHomeDirectory
initial <- (\exists -> if exists then candidate else "")
<$> liftIO (doesDirectoryExist candidate)
checkoutPath <- fromMaybe (error "EOF") <$> getInputLineWithInitial
("Enter optional path to local " ++ url ++ " checkout for faster cloning: ") (initial, "")
liftIO $ readProcess "git" (
[ "clone", url, path, "--recursive" ] ++
[ arg | not (null checkoutPath), arg <- [ "--reference-if-able", checkoutPath ] ]
) ""
return ()
type Hist = [String]
-- | Returns the nixpkgs-unstable channel commit history recorded by "https://channels.nix.gsc.io" in newest to oldest order
getHistory :: App Hist
getHistory = do
contents <- Cache.get (Cache.ExpiresAfter (15 * 60)) "history-nixpkgs-unstable" $ do
mgr <- lift $ asks manager
response <- liftIO $ responseBody <$> httpLbs (parseRequest_ url) mgr
let items = reverse . ("c47ac0d8bf43543d8dcef4895167dd1f7af9d968":) . map (head . BS.words) $ BS.lines response
return $ BS.unlines items
return $ map BS.unpack . BS.lines $ contents
where
url = "https://channels.nix.gsc.io/nixpkgs-unstable/history-v2"
-- | A GHC version
data Version = Version Int Int Int
deriving (Eq, Ord)
instance Show Version where
show (Version major minor patch) = show major ++ "." ++ show minor ++ "." ++ show patch
-- | Converts a GHC version to the format used for attributes in nixpkgs, such as "ghc864"
nixVersion :: Version -> String
nixVersion (Version major minor patch) = "ghc" ++ show major ++ show minor ++ show patch
-- | Matches a nixpkgs GHC attribute name such as "ghc864" as a version type
nixVersionRegex :: RE Char Version
nixVersionRegex = "ghc" *> (Version <$> digit <*> digit <*> digit)
where digit = read . (:[]) <$> psym isDigit
-- | Matches a GHC version string such as 8.6.4 to a version type
versionRegex :: RE Char Version
versionRegex = Version
<$> (int <* sym '.')
<*> (int <* sym '.')
<*> int
where int :: RE Char Int
int = read <$> many (psym isDigit)
-- | Matches a stack yaml file name such as "stack-8.6.4.yaml" to a GHC version
stackPathRegex :: RE Char Version
stackPathRegex = "stack-" *> versionRegex <* ".yaml"

View File

@ -1,43 +0,0 @@
module Options
( getOptions
, Options(..)
) where
import Options.Applicative
data Options = Options
{ optName :: String
, optRev :: String
, optRepo :: String
}
parser :: Parser Options
parser = Options
<$> strOption
( long "name"
<> short 'n'
<> metavar "NAME"
<> help "name of the HIE set to generate as, like stable or unstable"
)
<*> strOption
( long "revision"
<> short 'r'
<> metavar "REV"
<> help "HIE revision to use, accepts branches, git hashes, tags and more"
)
<*> strOption
( long "hie-repo"
<> metavar "URL"
<> help "Which repository to use"
<> value "https://github.com/haskell/haskell-ide-engine"
)
options :: ParserInfo Options
options = info (parser <**> helper)
( fullDesc
<> progDesc "Generate all-hies expressions"
)
getOptions :: IO Options
getOptions = customExecParser p options where
p = prefs showHelpOnEmpty

7
templates/Readme.md Normal file
View File

@ -0,0 +1,7 @@
# HIE template projects
This directory contains template projects with a fully working development environment:
- A haskell.nix based template for stack in [haskell.nix-stack](./haskell.nix-stack)
- A haskell.nix based template for cabal in [haskell.nix-cabal](./haskell.nix-cabal)
- A nixpkgs Haskell infrastructure based template for cabal in [nixpkgs-cabal](nixpkgs-cabal)

View File

@ -0,0 +1 @@
use nix

View File

@ -0,0 +1,2 @@
result
dist-newstyle

View File

@ -0,0 +1,4 @@
module Main where
main :: IO ()
main = putStrLn "Hello!"

View File

@ -0,0 +1,81 @@
# Nix-based Haskell project template using [haskell.nix](https://input-output-hk.github.io/haskell.nix/)
This template has support for:
- Building the project with Nix
- Entering a dev environment with Nix, which includes
- GHC and cabal-install for the `cabal` command
- All the projects Haskell dependencies
- Haskell IDE Engine with a working Cabal version
- An up-to-date local Hoogle database, usable by HIE
- Minimal compilation since most things are cached already
It uses the haskell.nix Haskell infrastructure for this.
# Usage
## Setting up the caches
To use this, you should first enable the necessary Nix caches so that most things don't have to be compiled. This is done using [Cachix](https://cachix.org/). If you don't have it already, you can install cachix with
```
$ nix-env -iA cachix -f https://cachix.org/api/v1/install
```
After which you can enable the `all-hies` and `iohk` caches, both of which are recommended for this template:
```
$ cachix use all-hies
$ cachix use iohk
```
## Entering the dev environment
This can be done either using `nix-shell`:
```
$ nix-shell
[nix-shell:~/all-hies/templates/haskell.nix-cabal]$
```
Or automatically when you enter the project directory using [direnv](https://direnv.net/) or [lorri](https://github.com/target/lorri) (by running `lorri init` first). Note that entering the environment the first time will take quite some time due to how haskell.nix works.
After entering the environment you can use the standard `cabal` commands for interacting with the project. Note that these will use all dependencies from Nix:
```
$ cabal build # building the project
$ cabal repl # Getting a ghci repl
$ cabal run # Running an executable
```
In this environment HIE is available, which you can verify works with the `hie` command:
```
$ hie
[...]
/home/infinisil/all-hies/templates/haskell.nix-cabal/Main.hs: OK
```
The easiest way to get your editor to find HIE is to just start it in this environment:
```
$ vim
$ emacs
$ code
$ sublime
$ atom
```
Note that you still need to set up the necessary editor extensions yourself. See [here](https://github.com/haskell/haskell-ide-engine#editor-integration) for how to do this
A local Hoogle database is also available with all the dependencies of the project, which is used by HIE. You can start a hoogle server using
```
$ hoogle server
Server started on port 8080
Reading log...0.00s
2020-07-25T01:29:13.173630988 - Server starting on port 8080 and host/IP HostAny
```
## Building the project with Nix
This is done with just a `nix-build` in the root.
```
$ nix-build
```

View File

@ -0,0 +1,21 @@
name: all-hies-template
version: 0.1.0.0
-- synopsis:
-- description:
-- homepage:
-- license:
-- license-file: LICENSE
-- author:
-- maintainer:
-- copyright:
-- category: Web
build-type: Simple
cabal-version: 2.0
executable all-hies-template
main-is: Main.hs
default-language: Haskell2010
build-depends: base >= 4.7 && < 5
-- Cabal needed for HIEs cabal-helper, needs to match the
-- cabal(-install) version in default.nix
, Cabal == 3.2.0.0

View File

@ -0,0 +1,3 @@
packages: .
index-state: 2020-05-15T00:00:00Z

View File

@ -0,0 +1,50 @@
let
haskellNixSrc = fetchTarball {
url = "https://github.com/input-output-hk/haskell.nix/tarball/af5998fe8d6b201d2a9be09993f1b9fae74e0082";
sha256 = "0z5w99wkkpg2disvwjnsyp45w0bhdkrhvnrpz5nbwhhp21c71mbn";
};
haskellNix = import haskellNixSrc {};
all-hies = ../..;
# Use this version for your project instead
/*
all-hies = fetchTarball {
# Insert the desired all-hies commit here
url = "https://github.com/infinisil/all-hies/tarball/000000000000000000000000000000000000000";
# Insert the correct hash after the first evaluation
sha256 = "0000000000000000000000000000000000000000000000000000";
};
*/
pkgs = import haskellNix.sources.nixpkgs-2003 (haskellNix.nixpkgsArgs // {
overlays = haskellNix.nixpkgsArgs.overlays ++ [
(import all-hies {}).overlay
];
});
set = pkgs.haskell-nix.cabalProject' {
name = "all-hies-template";
src = pkgs.haskell-nix.haskellLib.cleanGit {
name = "all-hies-template";
src = ./.;
};
ghc = pkgs.haskell-nix.compiler.ghc883;
modules = [{
# Make Cabal reinstallable
nonReinstallablePkgs = [ "rts" "ghc-heap" "ghc-prim" "integer-gmp" "integer-simple" "base" "deepseq" "array" "ghc-boot-th" "pretty" "template-haskell" "ghcjs-prim" "ghcjs-th" "ghc-boot" "ghc" "Win32" "array" "binary" "bytestring" "containers" "directory" "filepath" "ghc-boot" "ghc-compact" "ghc-prim" "hpc" "mtl" "parsec" "process" "text" "time" "transformers" "unix" "xhtml" "terminfo" ];
}];
};
in set.hsPkgs.all-hies-template.components.exes.all-hies-template // {
env = set.hsPkgs.shellFor {
packages = p: [ p.all-hies-template ];
exactDeps = true;
tools = {
cabal = "3.2.0.0";
hie = "unstable";
};
shellHook = ''
export HIE_HOOGLE_DATABASE=$(realpath "$(dirname "$(realpath "$(which hoogle)")")/../share/doc/hoogle/default.hoo")
'';
};
}

View File

@ -0,0 +1 @@
(import ./.).env

View File

@ -0,0 +1 @@
use nix

View File

@ -0,0 +1,2 @@
result
.stack-work

View File

@ -0,0 +1,4 @@
module Main where
main :: IO ()
main = putStrLn "Hello!"

View File

@ -0,0 +1,81 @@
# Nix-based Haskell project template using [haskell.nix](https://input-output-hk.github.io/haskell.nix/) and [Stack](https://docs.haskellstack.org/en/stable/README/)
This template has support for:
- Building the project with Nix
- Entering a dev environment with Nix, which includes
- GHC and stack
- All the projects Haskell dependencies
- Haskell IDE Engine with a working Cabal version
- An up-to-date local Hoogle database, usable by HIE
- Minimal compilation since most things are cached already
It uses the haskell.nix Haskell infrastructure for this.
# Usage
## Setting up the caches
To use this, you should first enable the necessary Nix caches so that most things don't have to be compiled. This is done using [Cachix](https://cachix.org/). If you don't have it already, you can install cachix with
```
$ nix-env -iA cachix -f https://cachix.org/api/v1/install
```
After which you can enable the `all-hies` and `iohk` caches, both of which are recommended for this template:
```
$ cachix use all-hies
$ cachix use iohk
```
## Entering the dev environment
This can be done either using `nix-shell`:
```
$ nix-shell
[nix-shell:~/all-hies/templates/haskell.nix-stack]$
```
Or automatically when you enter the project directory using [direnv](https://direnv.net/) or [lorri](https://github.com/target/lorri) (by running `lorri init` first). Note that entering the environment the first time will take quite some time due to how haskell.nix works.
After entering the environment you can use the standard `stack` commands for interacting with the project. Note that these will use all dependencies from Nix:
```
$ stack build # building the project
$ stack repl # Getting a ghci repl
$ stack run # Running an executable
```
In this environment HIE is available, which you can verify works with the `hie` command:
```
$ hie
[...]
/home/infinisil/all-hies/templates/haskell.nix-stack/Main.hs: OK
```
The easiest way to get your editor to find HIE is to just start it in this environment:
```
$ vim
$ emacs
$ code
$ sublime
$ atom
```
Note that you still need to set up the necessary editor extensions yourself. See [here](https://github.com/haskell/haskell-ide-engine#editor-integration) for how to do this
A local Hoogle database is also available with all the dependencies of the project, which is used by HIE. You can start a hoogle server using
```
$ hoogle server
Server started on port 8080
Reading log...0.00s
2020-07-25T01:29:13.173630988 - Server starting on port 8080 and host/IP HostAny
```
## Building the project with Nix
This is done with just a `nix-build` in the root.
```
$ nix-build
```

View File

@ -0,0 +1,21 @@
name: all-hies-template
version: 0.1.0.0
-- synopsis:
-- description:
-- homepage:
-- license:
-- license-file: LICENSE
-- author:
-- maintainer:
-- copyright:
-- category: Web
build-type: Simple
cabal-version: 2.0
executable all-hies-template
main-is: Main.hs
default-language: Haskell2010
build-depends: base >= 4.7 && < 5
-- Cabal needed for HIEs cabal-helper, needs to match the
-- cabal(-install) version in default.nix
, Cabal == 3.2.0.0

View File

@ -0,0 +1,3 @@
packages: .
index-state: 2020-05-15T00:00:00Z

View File

@ -0,0 +1,48 @@
let
haskellNixSrc = fetchTarball {
url = "https://github.com/input-output-hk/haskell.nix/tarball/af5998fe8d6b201d2a9be09993f1b9fae74e0082";
sha256 = "0z5w99wkkpg2disvwjnsyp45w0bhdkrhvnrpz5nbwhhp21c71mbn";
};
haskellNix = import haskellNixSrc {};
all-hies = ../..;
# Use this version for your project instead
/*
all-hies = fetchTarball {
# Insert the desired all-hies commit here
url = "https://github.com/infinisil/all-hies/tarball/000000000000000000000000000000000000000";
# Insert the correct hash after the first evaluation
sha256 = "0000000000000000000000000000000000000000000000000000";
};
*/
pkgs = import haskellNix.sources.nixpkgs-2003 (haskellNix.nixpkgsArgs // {
overlays = haskellNix.nixpkgsArgs.overlays ++ [
(import all-hies {}).overlay
];
});
set = pkgs.haskell-nix.stackProject {
name = "all-hies-template";
src = pkgs.haskell-nix.haskellLib.cleanGit {
name = "all-hies-template";
src = ./.;
};
modules = [{
# Make Cabal reinstallable
nonReinstallablePkgs = [ "rts" "ghc-heap" "ghc-prim" "integer-gmp" "integer-simple" "base" "deepseq" "array" "ghc-boot-th" "pretty" "template-haskell" "ghcjs-prim" "ghcjs-th" "ghc-boot" "ghc" "Win32" "array" "binary" "bytestring" "containers" "directory" "filepath" "ghc-boot" "ghc-compact" "ghc-prim" "hpc" "mtl" "parsec" "process" "text" "time" "transformers" "unix" "xhtml" "terminfo" ];
}];
};
in set.all-hies-template.components.exes.all-hies-template // {
env = set.shellFor {
packages = p: [ p.all-hies-template ];
tools = {
hie = "unstable";
};
nativeBuildInputs = [ pkgs.stack ];
shellHook = ''
export HIE_HOOGLE_DATABASE=$(realpath "$(dirname "$(realpath "$(which hoogle)")")/../share/doc/hoogle/default.hoo")
'';
};
}

View File

@ -0,0 +1 @@
(import ./.).env

View File

@ -0,0 +1,67 @@
# This file was automatically generated by 'stack init'
#
# Some commonly used options have been documented as comments in this file.
# For advanced use and comprehensive documentation of the format, please see:
# https://docs.haskellstack.org/en/stable/yaml_configuration/
# Resolver to choose a 'specific' stackage snapshot or a compiler version.
# A snapshot resolver dictates the compiler version and the set of packages
# to be used for project dependencies. For example:
#
# resolver: lts-3.5
# resolver: nightly-2015-09-21
# resolver: ghc-7.10.2
#
# The location of a snapshot can be provided as a file or url. Stack assumes
# a snapshot provided as a file might change, whereas a url resource does not.
#
# resolver: ./custom-snapshot.yaml
# resolver: https://example.com/snapshots/2018-01-01.yaml
resolver: lts-15.12
# User packages to be built.
# Various formats can be used as shown in the example below.
#
# packages:
# - some-directory
# - https://example.com/foo/bar/baz-0.0.2.tar.gz
# subdirs:
# - auto-update
# - wai
packages:
- .
# Dependency packages to be pulled from upstream that are not in the resolver.
# These entries can reference officially published versions as well as
# forks / in-progress versions pinned to a git hash. For example:
#
extra-deps:
- Cabal-3.2.0.0
# - acme-missiles-0.3
# - git: https://github.com/commercialhaskell/stack.git
# commit: e7b331f14bcffb8367cd58fbfc8b40ec7642100a
#
# extra-deps: []
# Override default flag values for local packages and extra-deps
# flags: {}
# Extra package databases containing global packages
# extra-package-dbs: []
# Control whether we use the GHC we find on the path
# system-ghc: true
#
# Require a specific version of stack, using version ranges
# require-stack-version: -any # Default
# require-stack-version: ">=2.1"
#
# Override the architecture used by stack, especially useful on Windows
# arch: i386
# arch: x86_64
#
# Extra directories used by stack for building
# extra-include-dirs: [/path/to/dir]
# extra-lib-dirs: [/path/to/dir]
#
# Allow a newer minor version of GHC than the snapshot specifies
# compiler-check: newer-minor

View File

@ -0,0 +1 @@
use nix

2
templates/nixpkgs-cabal/.gitignore vendored Normal file
View File

@ -0,0 +1,2 @@
result
dist-newstyle

View File

@ -0,0 +1,4 @@
module Main where
main :: IO ()
main = putStrLn "Hello!"

View File

@ -0,0 +1,80 @@
# Nix-based Haskell project template using nixpkgs' Haskell infrastructure
This template has support for:
- Building the project with Nix
- Entering a dev environment with Nix, which includes
- GHC and cabal-install for the `cabal` command
- All the projects Haskell dependencies
- Haskell IDE Engine with a working Cabal version
- An up-to-date local Hoogle database, usable by HIE
- Minimal compilation since most things are cached already
It uses the nixpkgs Haskell infrastructure for this.
# Usage
## Setting up the caches
To use this, you should first enable the necessary Nix caches so that most things don't have to be compiled. This is done using [Cachix](https://cachix.org/). If you don't have it already, you can install cachix with
```
$ nix-env -iA cachix -f https://cachix.org/api/v1/install
```
After which you can enable the `all-hies` cache:
```
$ cachix use all-hies
```
## Entering the dev environment
This can be done either using `nix-shell`:
```
$ nix-shell
[nix-shell:~/all-hies/templates/nixpkgs-cabal]$
```
Or automatically when you enter the project directory using [direnv](https://direnv.net/) or [lorri](https://github.com/target/lorri) (by running `lorri init` first)
After entering the environment you can use the standard `cabal` commands for interacting with the project. Note that these will use all dependencies from Nix:
```
$ cabal build # building the project
$ cabal repl # Getting a ghci repl
$ cabal run # Running an executable
```
In this environment HIE is available, which you can verify works with the `hie` command:
```
$ hie
[...]
/home/infinisil/all-hies/templates/nixpkgs-cabal/Main.hs: OK
```
The easiest way to get your editor to find HIE is to just start it in this environment:
```
$ vim
$ emacs
$ code
$ sublime
$ atom
```
Note that you still need to set up the necessary editor extensions yourself. See [here](https://github.com/haskell/haskell-ide-engine#editor-integration) for how to do this
A local Hoogle database is also available with all the dependencies of the project, which is used by HIE. You can start a hoogle server using
```
$ hoogle server
Server started on port 8080
Reading log...0.00s
2020-07-25T01:29:13.173630988 - Server starting on port 8080 and host/IP HostAny
```
## Building the project with Nix
This is done with just a `nix-build` in the root.
```
$ nix-build
```

View File

@ -0,0 +1,20 @@
name: all-hies-template
version: 0.1.0.0
-- synopsis:
-- description:
-- homepage:
-- license:
-- license-file: LICENSE
-- author:
-- maintainer:
-- copyright:
-- category: Web
build-type: Simple
cabal-version: 2.0
executable all-hies-template
main-is: Main.hs
default-language: Haskell2010
build-depends: base >= 4.7 && < 5
-- Cabal needed for HIEs cabal-helper
, Cabal

View File

@ -0,0 +1,52 @@
let
nixpkgs = fetchTarball {
url = "https://github.com/NixOS/nixpkgs/tarball/f8248ab6d9e69ea9c07950d73d48807ec595e923";
sha256 = "009i9j6mbq6i481088jllblgdnci105b2q4mscprdawg3knlyahk";
};
all-hies = ../..;
# Use this version for your project instead
/*
all-hies = fetchTarball {
# Insert the desired all-hies commit here
url = "https://github.com/infinisil/all-hies/tarball/000000000000000000000000000000000000000";
# Insert the correct hash after the first evaluation
sha256 = "0000000000000000000000000000000000000000000000000000";
};
*/
pkgs = import nixpkgs {
config = {};
overlays = [
(import all-hies {}).overlay
];
};
inherit (pkgs) lib;
set = pkgs.haskell.packages.ghc865.override (old: {
overrides = lib.composeExtensions old.overrides (hself: hsuper: {
all-hies-template = hself.callCabal2nix "all-hies-template" (lib.sourceByRegex ./. [
"^.*\\.hs$"
"^.*\\.cabal$"
]) {
# Needs to match cabal-install version
Cabal = hself.Cabal_3_0_0_0;
};
});
});
in pkgs.haskell.lib.justStaticExecutables set.all-hies-template // {
env = set.shellFor {
packages = p: [ p.all-hies-template ];
nativeBuildInputs = [
set.cabal-install
set.hie
];
withHoogle = true;
shellHook = ''
export HIE_HOOGLE_DATABASE=$(realpath "$(dirname "$(realpath "$(which hoogle)")")/../share/doc/hoogle/default.hoo")
'';
};
inherit set;
}

View File

@ -0,0 +1 @@
(import ./.).env

View File

@ -1,31 +0,0 @@
{ pkgs ? import ./nixpkgs.nix
}:
let
inherit (pkgs) lib;
hpkgs = pkgs.haskellPackages;
runtimeDeps = [
pkgs.nix-prefetch-scripts
pkgs.git
pkgs.haskellPackages.cabal-install
pkgs.nix
pkgs.coreutils
pkgs.gawk
];
pkg = (hpkgs.callCabal2nix "all-hies" (pkgs.lib.sourceByRegex ./. [
"src.*"
"all-hies.cabal"
]) {}).overrideAttrs (old: {
nativeBuildInputs = old.nativeBuildInputs or [] ++ [
pkgs.makeWrapper
];
postInstall = old.postInstall or "" + ''
wrapProgram $out/bin/update \
--set PATH "${lib.makeBinPath runtimeDeps}" \
--set LOCALE_ARCHIVE "${pkgs.glibcLocales}/lib/locale/locale-archive"
'';
});
in pkg // {
env = pkg.env.overrideAttrs (old: {
nativeBuildInputs = old.nativeBuildInputs or [] ++ runtimeDeps;
});
}