Skip to content
This repository has been archived by the owner on Oct 8, 2021. It is now read-only.

Commit

Permalink
HIE works
Browse files Browse the repository at this point in the history
  • Loading branch information
Guillaume Desforges committed Jan 10, 2020
1 parent a38d095 commit 44514b7
Show file tree
Hide file tree
Showing 7 changed files with 29 additions and 16 deletions.
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
!.vscode/

**/dist-newstyle/
3 changes: 3 additions & 0 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"nixEnvSelector.nixShellConfig": "${workspaceRoot}/shell.nix"
}
8 changes: 6 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -68,9 +68,13 @@ Repeat from step (2) when you add, remove or modify a `.cabal` file.

### Configuration

It is advised to edit only the following specified files (except if you know what you are doing).
Some parameters can be configured by editing the file `./nix/confgi.nix`.

* The most basic parameters are in `./nix/config.nix`.
For now you can:
* Change the GHC version to use
* Warning: check that this version is supported by nixpkgs and your IDE
* Select the IDE used
* For now either ghcide (default) or HIE

## Motivations

Expand Down
5 changes: 2 additions & 3 deletions nix/config.nix
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@
# GHC version
ghc-version = "ghc865";

# IDEs
use-ghcide = true;
use-hie = false;
# IDEs (either "ghcide" or "hie")
ide = "ghcide";
}
7 changes: 4 additions & 3 deletions nix/hie.nix
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
# selector:
# * Function to select HIE ghc versions. See here https://github.com/Infinisil/all-hies#declarative-installation-nixos-home-manager-or-similar
# * Example: p: { inherit (p) ghc865; }
{ selector }:
{ ghc-version }:
let
# HIE from all-hies (use Cachix !)
all-hies = import (fetchTarball "https://github.com/infinisil/all-hies/tarball/master") {};
all-hies-rev = "master";
all-hies = import (fetchTarball "https://github.com/infinisil/all-hies/tarball/${all-hies-rev}") {};
in
all-hies.selection { inherit selector; }
all-hies.selection { selector = p: { "${ghc-version}" = builtins.getAttr ghc-version p; }; }
12 changes: 6 additions & 6 deletions nix/nixpkgs.nix
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
{ usePinnedNixpkgs ? false }:
# The version of nixpkgs used for this project
let
# Either a pinned version
get-pinned-nixpkgs = rev:
get-pinned-nixpkgs = ref: rev:
builtins.fetchGit {
url = "https://github.com/NixOS/nixpkgs.git";
ref = "master";
inherit rev;
inherit ref rev;
};
# pinned-nixpkgs = get-pinned-nixpkgs "cca0c894a13ec398de8b046174239513197f5c74"
pinned-nixpkgs = get-pinned-nixpkgs "master" "cca0c894a13ec398de8b046174239513197f5c74" {};

# Or the current local
current-local = import <nixpkgs>;
current-local = import <nixpkgs> {};
in
current-local
if usePinnedNixpkgs then pinned-nixpkgs else current-local
7 changes: 5 additions & 2 deletions shell.nix
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,12 @@ let
ghc-selector = p: pkgs.lib.attrsets.getAttr ghc-version p;

# IDEs to chose from
inherit (config) use-ghcide use-hie;
inherit (config) ide;
use-ghcide = ide == "ghcide";
use-hie = ide == "hie";

ghcide = pkgs.lib.attrsets.getAttr ("ghcide-" + ghc-version) (import ./nix/ghcide.nix);
hie = import ./nix/hie.nix { selector = ghc-selector; };
hie = import ./nix/hie.nix { inherit ghc-version; };

# Haskell package set with ghcWithPackages changed to always add Hoogle
haskellPackages = ghc-selector pkgs.haskell.packages;
Expand Down

0 comments on commit 44514b7

Please sign in to comment.