Merge pull request #268619 from tweag/lib-descriptions
[NixPkgs.git] / pkgs / development / haskell-modules / configuration-ghc-9.6.x.nix
blob803e34163f9d9a4f2d2588cdc307bffc722eb6d1
1 { pkgs, haskellLib }:
3 with haskellLib;
5 let
6   inherit (pkgs) lib;
8   jailbreakWhileRevision = rev:
9     overrideCabal (old: {
10       jailbreak = assert old.revision or "0" == toString rev; true;
11     });
12   checkAgainAfter = pkg: ver: msg: act:
13     if builtins.compareVersions pkg.version ver <= 0 then act
14     else
15       builtins.throw "Check if '${msg}' was resolved in ${pkg.pname} ${pkg.version} and update or remove this";
16   jailbreakForCurrentVersion = p: v: checkAgainAfter p v "bad bounds" (doJailbreak p);
18   # Workaround for a ghc-9.6 issue: https://gitlab.haskell.org/ghc/ghc/-/issues/23392
19   disableParallelBuilding = overrideCabal (drv: { enableParallelBuilding = false; });
22 self: super: {
23   llvmPackages = lib.dontRecurseIntoAttrs self.ghc.llvmPackages;
25   # Disable GHC core libraries
26   array = null;
27   base = null;
28   binary = null;
29   bytestring = null;
30   Cabal = null;
31   Cabal-syntax = null;
32   containers = null;
33   deepseq = null;
34   directory = null;
35   exceptions = null;
36   filepath = null;
37   ghc-bignum = null;
38   ghc-boot = null;
39   ghc-boot-th = null;
40   ghc-compact = null;
41   ghc-heap = null;
42   ghc-prim = null;
43   ghci = null;
44   haskeline = null;
45   hpc = null;
46   integer-gmp = null;
47   libiserv = null;
48   mtl = null;
49   parsec = null;
50   pretty = null;
51   process = null;
52   rts = null;
53   stm = null;
54   system-cxx-std-lib = null;
55   template-haskell = null;
56   # terminfo is not built if GHC is a cross compiler
57   terminfo = if pkgs.stdenv.hostPlatform == pkgs.stdenv.buildPlatform then null else self.terminfo_0_4_1_5;
58   text = null;
59   time = null;
60   transformers = null;
61   unix = null;
62   xhtml = null;
64   #
65   # Version deviations from Stackage LTS
66   #
68   doctest = doDistribute super.doctest_0_22_2;
69   http-api-data = doDistribute self.http-api-data_0_6; # allows base >= 4.18
70   some = doDistribute self.some_1_0_6;
71   th-abstraction = doDistribute self.th-abstraction_0_6_0_0;
72   th-desugar = doDistribute self.th-desugar_1_16;
73   semigroupoids = doDistribute self.semigroupoids_6_0_0_1;
74   bifunctors = doDistribute self.bifunctors_5_6_1;
75   base-compat = doDistribute self.base-compat_0_13_1;
76   base-compat-batteries = doDistribute self.base-compat-batteries_0_13_1;
77   fgl = doDistribute self.fgl_5_8_2_0;
79   # Because we bumped the version of th-abstraction above.^
80   aeson = doJailbreak super.aeson;
81   free = doJailbreak super.free;
83   # Because we bumped the version of base-compat above.^
84   cabal-plan = unmarkBroken super.cabal-plan;
85   cabal-plan-bounds = unmarkBroken super.cabal-plan-bounds;
87   # Requires filepath >= 1.4.100.0 <=> GHC >= 9.6
88   file-io = unmarkBroken super.file-io;
90   # Too strict upper bound on template-haskell
91   # https://github.com/mokus0/th-extras/pull/21
92   th-extras = doJailbreak super.th-extras;
94   ghc-lib = doDistribute self.ghc-lib_9_6_3_20231014;
95   ghc-lib-parser = doDistribute self.ghc-lib-parser_9_6_3_20231014;
96   ghc-lib-parser-ex = doDistribute self.ghc-lib-parser-ex_9_6_0_2;
98   # Tests fail due to the newly-build fourmolu not being in PATH
99   # https://github.com/fourmolu/fourmolu/issues/231
100   fourmolu = dontCheck super.fourmolu_0_14_0_0;
101   ormolu = self.generateOptparseApplicativeCompletions [ "ormolu" ] (enableSeparateBinOutput super.ormolu_0_7_2_0);
102   hlint = super.hlint_3_6_1;
104   # v0.1.6 forbids base >= 4.18
105   singleton-bool = doDistribute super.singleton-bool_0_1_7;
107   #
108   # Too strict bounds without upstream fix
109   #
111   # Forbids transformers >= 0.6
112   quickcheck-classes-base = doJailbreak super.quickcheck-classes-base;
113   # Forbids mtl >= 2.3
114   ChasingBottoms = doJailbreak super.ChasingBottoms;
115   # Forbids base >= 4.18
116   cabal-install-solver = doJailbreak super.cabal-install-solver;
117   cabal-install = doJailbreak super.cabal-install;
119   # Forbids base >= 4.18, fix proposed: https://github.com/sjakobi/newtype-generics/pull/25
120   newtype-generics = jailbreakForCurrentVersion super.newtype-generics "0.6.2";
122   cborg-json = jailbreakForCurrentVersion super.cborg-json "0.2.5.0";
123   serialise = jailbreakForCurrentVersion super.serialise "0.2.6.0";
125   #
126   # Too strict bounds, waiting on Hackage release in nixpkgs
127   #
129   #
130   # Compilation failure workarounds
131   #
133   # Add support for time 1.10
134   # https://github.com/vincenthz/hs-hourglass/pull/56
135   hourglass = appendPatches [
136       (pkgs.fetchpatch {
137         name = "hourglass-pr-56.patch";
138         url =
139           "https://github.com/vincenthz/hs-hourglass/commit/cfc2a4b01f9993b1b51432f0a95fa6730d9a558a.patch";
140         sha256 = "sha256-gntZf7RkaR4qzrhjrXSC69jE44SknPDBmfs4z9rVa5Q=";
141       })
142     ] (super.hourglass);
145   # Test suite doesn't compile with base-4.18 / GHC 9.6
146   # https://github.com/dreixel/syb/issues/40
147   syb = dontCheck super.syb;
149   # Support for template-haskell >= 2.16
150   language-haskell-extract = appendPatch (pkgs.fetchpatch {
151     url = "https://gitlab.haskell.org/ghc/head.hackage/-/raw/dfd024c9a336c752288ec35879017a43bd7e85a0/patches/language-haskell-extract-0.2.4.patch";
152     sha256 = "0w4y3v69nd3yafpml4gr23l94bdhbmx8xky48a59lckmz5x9fgxv";
153   }) (doJailbreak super.language-haskell-extract);
155   # Patch 0.17.1 for support of mtl-2.3
156   xmonad-contrib = appendPatch
157     (pkgs.fetchpatch {
158       name = "xmonad-contrib-mtl-2.3.patch";
159       url = "https://github.com/xmonad/xmonad-contrib/commit/8cb789af39e93edb07f1eee39c87908e0d7c5ee5.patch";
160       sha256 = "sha256-ehCvVy0N2Udii/0K79dsRSBP7/i84yMoeyupvO8WQz4=";
161     })
162     (doJailbreak super.xmonad-contrib);
164   # Patch 0.12.0.1 for support of unix-2.8.0.0
165   arbtt = appendPatch
166     (pkgs.fetchpatch {
167       name = "arbtt-unix-2.8.0.0.patch";
168       url = "https://github.com/nomeata/arbtt/pull/168/commits/ddaac94395ac50e3d3cd34c133dda4a8e5a3fd6c.patch";
169       sha256 = "sha256-5Gmz23f4M+NfgduA5O+9RaPmnneAB/lAlge8MrFpJYs=";
170     })
171     super.arbtt;
173   # 2023-04-03: plugins disabled for hls 1.10.0.0 based on
174   #
175   haskell-language-server = super.haskell-language-server.override {
176       hls-floskell-plugin = null;
177     };
179   # Newer version of servant required for GHC 9.6
180   servant = self.servant_0_20_1;
181   servant-server = self.servant-server_0_20;
182   servant-client = self.servant-client_0_20;
183   servant-client-core = self.servant-client-core_0_20;
184   # Select versions compatible with servant_0_20_1
185   servant-docs = self.servant-docs_0_13;
186   servant-swagger = self.servant-swagger_1_2;
187   # Jailbreaks for servant <0.20
188   servant-lucid = doJailbreak super.servant-lucid;
190   # Jailbreak strict upper bounds: http-api-data <0.6
191   servant_0_20_1 = doJailbreak super.servant_0_20_1;
192   servant-server_0_20 = doJailbreak super.servant-server_0_20;
193   servant-client_0_20 = doJailbreak super.servant-client_0_20;
194   servant-client-core_0_20 = doJailbreak super.servant-client-core_0_20;
195   # Jailbreak strict upper bounds: doctest <0.22
196   servant-swagger_1_2 = doJailbreak super.servant-swagger_1_2;
198   lifted-base = dontCheck super.lifted-base;
199   hw-fingertree = dontCheck super.hw-fingertree;
200   hw-prim = dontCheck (doJailbreak super.hw-prim);
201   stm-containers = dontCheck super.stm-containers;
202   regex-tdfa = dontCheck super.regex-tdfa;
203   rebase = doJailbreak super.rebase_1_20_1_1;
204   rerebase = doJailbreak super.rerebase_1_20_1_1;
205   hiedb = dontCheck super.hiedb;
206   retrie = dontCheck super.retrie;
207   # https://github.com/kowainik/relude/issues/436
208   relude = dontCheck (doJailbreak super.relude);
210   ghc-exactprint = unmarkBroken (addBuildDepends (with self.ghc-exactprint.scope; [
211    HUnit Diff data-default extra fail free ghc-paths ordered-containers silently syb
212   ]) super.ghc-exactprint_1_7_0_1);
214   inherit (pkgs.lib.mapAttrs (_: doJailbreak ) super)
215     hls-cabal-plugin
216     algebraic-graphs
217     co-log-core
218     lens
219     cryptohash-sha1
220     cryptohash-md5
221     ghc-trace-events
222     tasty-hspec
223     constraints-extras
224     tree-diff
225     implicit-hie-cradle
226     focus
227     hie-compat
228     dbus       # template-haskell >=2.18 && <2.20, transformers <0.6, unix <2.8
229     gi-cairo-connector          # mtl <2.3
230     haskintex                   # text <2
231     lens-family-th              # template-haskell <2.19
232     ghc-prof                    # base <4.18
233     profiteur                   # vector <0.13
234     mfsolve                     # mtl <2.3
235     cubicbezier                 # mtl <2.3
236     dhall                       # template-haskell <2.20
237     env-guard                   # doctest <0.21
238     package-version             # doctest <0.21, tasty-hedgehog <1.4
239   ;
241   # Avoid triggering an issue in ghc-9.6.2
242   gi-gtk = disableParallelBuilding super.gi-gtk;
244   # Pending text-2.0 support https://github.com/gtk2hs/gtk2hs/issues/327
245   gtk = doJailbreak super.gtk;
247   # Doctest comments have bogus imports.
248   bsb-http-chunked = dontCheck super.bsb-http-chunked;
250   # Fix ghc-9.6.x build errors.
251   libmpd = appendPatch
252     # https://github.com/vimus/libmpd-haskell/pull/138
253     (pkgs.fetchpatch { url = "https://github.com/vimus/libmpd-haskell/compare/95d3b3bab5858d6d1f0e079d0ab7c2d182336acb...5737096a339edc265a663f51ad9d29baee262694.patch";
254                        name = "vimus-libmpd-haskell-pull-138.patch";
255                        sha256 = "sha256-CvvylXyRmoCoRJP2MzRwL0SBbrEzDGqAjXS+4LsLutQ=";
256                      })
257     super.libmpd;
259   # Apply patch from PR with mtl-2.3 fix.
260   ConfigFile = overrideCabal (drv: {
261     editedCabalFile = null;
262     buildDepends = drv.buildDepends or [] ++ [ self.HUnit ];
263     patches = [(pkgs.fetchpatch {
264       # https://github.com/jgoerzen/configfile/pull/12
265       name = "ConfigFile-pr-12.patch";
266       url = "https://github.com/jgoerzen/configfile/compare/d0a2e654be0b73eadbf2a50661d00574ad7b6f87...83ee30b43f74d2b6781269072cf5ed0f0e00012f.patch";
267       sha256 = "sha256-b7u9GiIAd2xpOrM0MfILHNb6Nt7070lNRIadn2l3DfQ=";
268     })];
269   }) super.ConfigFile;
271   # The curl executable is required for withApplication tests.
272   warp_3_3_29 = addTestToolDepend pkgs.curl super.warp_3_3_29;
274   # The NCG backend for aarch64 generates invalid jumps in some situations,
275   # the workaround on 9.6 is to revert to the LLVM backend (which is used
276   # for these sorts of situations even on 9.2 and 9.4).
277   # https://gitlab.haskell.org/ghc/ghc/-/issues/23746#note_525318
278   tls = if pkgs.stdenv.hostPlatform.isAarch64 then self.forceLlvmCodegenBackend super.tls else super.tls;