-
Notifications
You must be signed in to change notification settings - Fork 32
/
shell.nix
51 lines (45 loc) · 1.58 KB
/
shell.nix
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
let
pkgs = import nix/pkgs.nix;
# Must be the same as the GHC version used by `stack.yaml`!
ghcVersion = "8107";
# Wrap Stack to configure Nix integration and target the correct Stack-Nix file.
# That way non-Nix users are not polluted when using `stack.yaml`.
# --nix -> Enable Nix support
# --nix-path=\\"nixpkgs=${pkgs.path}\\" -> Stack uses this nixpkgs definition rather than the system one (defined in `NIX_PATH` environment variable)
# --nix-shell-file nix/shell-stack.nix -> Specify the Nix file to use (otherwise it uses shell.nix by default, which we don't want)
stack-wrapped = pkgs.symlinkJoin {
name = "stack";
paths = [ pkgs.stack ];
buildInputs = [ pkgs.makeWrapper ];
postBuild = ''
wrapProgram $out/bin/stack \
--add-flags "\
--nix \
--nix-path=\\"nixpkgs=${pkgs.path}\\"
--nix-shell-file nix/shell-stack.nix \
"
'';
};
in pkgs.mkShell {
buildInputs = [
# Packages needed at compilation/runtime #
pkgs.zlib
pkgs.docker
# Development tools #
# The build tool
stack-wrapped
# GHC compiler: can be useful e.g. if one wants to summon `ghci`
pkgs.haskell.packages."ghc${ghcVersion}".ghc
# Language Server Protocol (e.g. to use an LSP plugin in VS Code, Atom, Emacs, etc.)
pkgs.haskell.packages."ghc${ghcVersion}".haskell-language-server
# Formatter
pkgs.ormolu
# Nix integration #
# Actually depend on Nix itself for pure Nix shells
pkgs.nix
# Manage Nix package versions easily
pkgs.niv
# Nix file formatter
pkgs.nixpkgs-fmt
];
}