summaryrefslogtreecommitdiffstats
path: root/haskell/shell.nix
blob: 0f56c71463d29710c0a9bd8629707f7fa3f44d65 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
{ pkgs ?  import <nixpkgs> { } }:

let

  all-hies = import (fetchTarball "https://github.com/infinisil/all-hies/tarball/master") {};

  script = {
    build = pkgs.writeShellScriptBin "build" /* sh */ ''
      echo "this could be your buildscript"
    '';
    run = pkgs.writeShellScriptBin "run" /* sh */ ''
      echo "this could be your run script"
    '';
  };

in pkgs.mkShell {

  buildInputs = with pkgs; [
    script.build
    script.run

    # common tools
    # ------------
    cabal2nix
    cabal-install

    stylish-cabal
    haskellPackages.stylish-haskell
    haskellPackages.hoogle

    # automatically create CI scripts
    # https://github.com/haskell-CI/haskell-ci#quick-start-instructions
    haskell-ci

    # IDE setups
    # ----------

    # VSCode hde setup
    # https://github.com/haskell/haskell-ide-engine#using-vs-code-with-nix
    (pkgs.vscode.overrideDerivation (old: {
      postFixup = ''
        wrapProgram $out/bin/code --prefix PATH : ${lib.makeBinPath [
          # Install stable HIE for GHC 8.6.4 (multiple ghc versions are allowed)
          (all-hies.selection { selector = p: { inherit (p) ghc864; }; })
        ]}
      '';
    }))

  ];

  shellHook = ''
    HISTFILE=${toString ./.history}
  '';

}