forked from tweag/ormolu
-
Notifications
You must be signed in to change notification settings - Fork 0
/
default.nix
112 lines (106 loc) · 2.64 KB
/
default.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
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
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
{ pkgs ? (import ./nix/nixpkgs) }:
let
ormoluCompiler = "ghc865";
source = pkgs.lib.sourceByRegex ./. [
"^.*\.md$"
"^app.*$"
"^data.*$"
"^ormolu\.cabal$"
"^src.*$"
"^tests.*$"
];
haskellPackages = pkgs.haskell.packages.${ormoluCompiler}.override {
overrides = ormoluOverlay;
};
ormoluOverlay = self: super: {
"ormolu" = pkgs.haskell.lib.enableCabalFlag
(super.callCabal2nix "ormolu" source { }) "dev";
# Nixpkgs provides ghc-lib-parser-8.8.0.20190424, but we want
# ghc-lib-parser-8.8.1. We disable Haddock generation because it's way
# too slow.
"ghc-lib-parser" = pkgs.haskell.lib.dontHaddock
(super.callHackage "ghc-lib-parser" "8.8.1" { });
};
ormolize = import ./nix/ormolize {
inherit pkgs;
inherit haskellPackages;
};
# NOTE We have to exclude some directories for some packages because
# Ormolu needs files to be parsable by Haddock which is not always the
# case. For example some tests and examples do not parse.
excludedHackageDirs = {
"aws" = ["Examples"];
"distributed-process" = ["benchmarks"];
"esqueleto" = ["test"];
"fay" = ["examples"];
"postgrest" = ["test"];
};
ormolizedPackages = doCheck:
pkgs.lib.mapAttrs (name: p: ormolize {
package = p;
inherit doCheck;
excludedDirs =
if builtins.hasAttr name excludedHackageDirs
then excludedHackageDirs.${name}
else [];
}) haskellPackages;
in {
ormolu = haskellPackages.ormolu;
ormoluShell = haskellPackages.shellFor {
packages = ps: [
ps.ormolu
];
buildInputs = [
haskellPackages.cabal-install
haskellPackages.ghcid
];
};
inherit ormoluOverlay ormoluCompiler;
hackage = ormolizedPackages false;
hackageTests = with pkgs.lib; pkgs.recurseIntoAttrs (
let ps = [
"QuickCheck"
"ShellCheck"
"aeson"
"attoparsec"
"aws"
"capability"
"cassava"
"conduit"
"cryptonite"
"diagrams-core"
"distributed-process"
"esqueleto"
"fay"
"hakyll"
"haxl"
"hedgehog"
"hlint"
"megaparsec"
"ormolu"
"optics"
"postgrest"
"servant"
"servant-server"
"tensorflow"
"text_1_2_4_0"
"tls"
"yesod-core"
# Comment idempotence issue
# "Agda"
# "brick"
# "hledger"
# "http-client"
# "idris"
# "intero"
# "leksah"
# "pandoc"
# "pipes"
# "stack"
# Missing language extension
# "lens" #fixed in master
# "purescript"
];
in listToAttrs (map (p: nameValuePair p (ormolizedPackages true).${p}) ps)
);
}