-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathshell.nix
More file actions
63 lines (57 loc) · 1.49 KB
/
shell.nix
File metadata and controls
63 lines (57 loc) · 1.49 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
{ withHoogle ? true, withCommitHook ? true }:
with (import ./. { });
let
python-commit-hooks =
pkgs.python3Packages.pre-commit-hooks.overridePythonAttrs
(_: { doCheck = false; });
pre-commit-hooks = import sources.pre-commit-hooks;
pre-commit-config = if withCommitHook then {
src = ./.;
tools = pkgs;
settings = { hpack = { silent = true; }; };
hooks = {
yamllint.enable = true;
hpack.enable = true;
nixfmt = {
enable = true;
excludes = [ "nix/sources.nix" ];
};
nix-linter = {
enable = true;
excludes = [ "nix/sources.nix" ];
};
trailing-whitespace = {
enable = true;
name = "trailing-whitespace";
entry = "${python-commit-hooks}/bin/trailing-whitespace-fixer";
types = [ "text" ];
};
end-of-file = {
enable = true;
name = "end-of-file";
entry = "${python-commit-hooks}/bin/end-of-file-fixer";
types = [ "text" ];
};
};
} else {
src = ./.;
};
pre-commit-check = pre-commit-hooks.run pre-commit-config;
inherit (pkgs.haskell.lib) doBenchmark doCheck;
in haskellPkgs.shellFor {
packages = p: [ (doBenchmark (doCheck p.stoplight)) ];
inherit withHoogle;
doBenchmark = true;
nativeBuildInputs = with pkgs; [
cabal-install
ghcid
# haskell-language-server
hlint
hpack
ormolu
];
shellHook = ''
cd ''${CI_PROJECT_DIR:=$PWD}
{ ${pre-commit-check.shellHook} } 2> /dev/null
'';
}