-
-
Notifications
You must be signed in to change notification settings - Fork 422
Expand file tree
/
Copy pathflake.nix
More file actions
96 lines (88 loc) · 2.66 KB
/
flake.nix
File metadata and controls
96 lines (88 loc) · 2.66 KB
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
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
{
description = "Servant development environment";
inputs = {
nixpkgs.url = "github:NixOS/nixpkgs/nixpkgs-25.05-darwin";
flake-utils.url = "github:numtide/flake-utils";
};
outputs =
{
self,
nixpkgs,
flake-utils,
}:
flake-utils.lib.eachDefaultSystem (
system:
let
pkgs = import nixpkgs { inherit system; };
# We use fourmolu compiled with GHC 9.12
# as getting it to compile with lower GHC versions
# is complicated and this works out of the box.
haskellFormatter = pkgs.haskell.packages.ghc912.fourmolu_0_18_0_0;
haskellLinter = pkgs.hlint;
nixFormatter = pkgs.nixfmt-rfc-style;
mkDevShell =
{
compiler ? "ghc92",
tutorial ? false,
}:
let
ghc = pkgs.haskell.packages.${compiler}.ghcWithPackages (ghcPkg: [
# Some dependencies don't like being built with
# as part of a project, so we pull them from nix.
ghcPkg.zlib
ghcPkg.lzma
]);
docstuffs = pkgs.python3.withPackages (
ps: with ps; [
recommonmark
sphinx
sphinx_rtd_theme
]
);
in
pkgs.mkShell {
buildInputs =
with pkgs;
[
ghc
python3
wget
cabal-install
postgresql
openssl
stack
haskellPackages.hspec-discover
haskellFormatter
haskellLinter
nixFormatter
]
++ (
if tutorial then
[
docstuffs
postgresql
]
else
[ ]
);
};
mkCiShell = tools: pkgs.mkShell { buildInputs = tools; };
in
{
devShells = {
default = mkDevShell { };
tutorial = mkDevShell { tutorial = true; };
# Development shells for different GHC versions.
ghc92 = mkDevShell { compiler = "ghc92"; };
ghc94 = mkDevShell { compiler = "ghc94"; };
ghc96 = mkDevShell { compiler = "ghc96"; };
ghc98 = mkDevShell { compiler = "ghc98"; };
ghc910 = mkDevShell { compiler = "ghc910"; };
ghc912 = mkDevShell { compiler = "ghc912"; };
# Single-tool shells for CI checks.
haskellFormatter = mkCiShell [ haskellFormatter ];
haskellLinter = mkCiShell [ haskellLinter ];
};
}
);
}