4 inherit (pkgs) fetchpatch lib;
5 checkAgainAfter = pkg: ver: msg: act:
6 if builtins.compareVersions pkg.version ver <= 0 then act
8 builtins.throw "Check if '${msg}' was resolved in ${pkg.pname} ${pkg.version} and update or remove this";
13 jailbreakForCurrentVersion = p: v: checkAgainAfter p v "bad bounds" (doJailbreak p);
15 llvmPackages = lib.dontRecurseIntoAttrs self.ghc.llvmPackages;
17 # Disable GHC core libraries.
46 system-cxx-std-lib = null;
47 template-haskell = null;
48 # GHC only builds terminfo if it is a native compiler
49 terminfo = if pkgs.stdenv.hostPlatform == pkgs.stdenv.buildPlatform then null else self.terminfo_0_4_1_6;
54 # GHC only bundles the xhtml library if haddock is enabled, check if this is
55 # still the case when updating: https://gitlab.haskell.org/ghc/ghc/-/blob/0198841877f6f04269d6050892b98b5c3807ce4c/ghc.mk#L463
56 xhtml = if self.ghc.hasHaddock or true then null else self.xhtml_3000_3_0_0;
58 # Jailbreaks & Version Updates
60 hashable-time = doJailbreak super.hashable-time;
61 libmpd = doJailbreak super.libmpd;
62 lens-family-th = doJailbreak super.lens-family-th; # template-haskell <2.19
64 # generically needs base-orphans for 9.4 only
65 base-orphans = dontCheck (doDistribute super.base-orphans);
67 # the dontHaddock is due to a GHC panic. might be this bug, not sure.
68 # https://gitlab.haskell.org/ghc/ghc/-/issues/21619
69 hedgehog = dontHaddock super.hedgehog;
71 hpack = overrideCabal (drv: {
72 # Cabal 3.6 seems to preserve comments when reading, which makes this test fail
73 # 2021-10-10: 9.2.1 is not yet supported (also no issue)
75 "--skip=/Hpack/renderCabalFile/is inverse to readCabalFile/"
76 ] ++ drv.testFlags or [];
77 }) (doJailbreak super.hpack);
79 # Apply patches from head.hackage.
80 language-haskell-extract = appendPatch (pkgs.fetchpatch {
81 url = "https://gitlab.haskell.org/ghc/head.hackage/-/raw/dfd024c9a336c752288ec35879017a43bd7e85a0/patches/language-haskell-extract-0.2.4.patch";
82 sha256 = "0w4y3v69nd3yafpml4gr23l94bdhbmx8xky48a59lckmz5x9fgxv";
83 }) (doJailbreak super.language-haskell-extract);
85 # Tests depend on `parseTime` which is no longer available
86 hourglass = dontCheck super.hourglass;
88 # https://github.com/sjakobi/bsb-http-chunked/issues/38
89 bsb-http-chunked = dontCheck super.bsb-http-chunked;
91 # 2022-08-01: Tests are broken on ghc 9.2.4: https://github.com/wz1000/HieDb/issues/46
92 hiedb = dontCheck super.hiedb;
94 # 2022-10-06: https://gitlab.haskell.org/ghc/ghc/-/issues/22260
95 ghc-check = dontHaddock super.ghc-check;
97 ghc-tags = self.ghc-tags_1_6;
99 # Too strict upper bound on template-haskell
100 # https://github.com/mokus0/th-extras/issues/18
101 th-extras = doJailbreak super.th-extras;
103 # requires newer versions to work with GHC 9.4
104 servant = doJailbreak super.servant;
105 servant-server = doJailbreak super.servant-server;
106 servant-auth = doJailbreak super.servant-auth;
107 servant-auth-swagger = doJailbreak super.servant-auth-swagger;
108 servant-swagger = doJailbreak super.servant-swagger;
109 servant-client-core = doJailbreak super.servant-client-core;
110 servant-client = doJailbreak super.servant-client;
111 # https://github.com/kowainik/relude/issues/436
112 relude = dontCheck super.relude;
117 hls_overlay = lself: lsuper: {
118 ghc-lib-parser = lself.ghc-lib-parser_9_6_3_20231014;
119 ghc-lib-parser-ex = doDistribute lself.ghc-lib-parser-ex_9_6_0_2;
120 Cabal-syntax = lself.Cabal-syntax_3_10_2_0;
123 lib.mapAttrs (_: pkg: doDistribute (pkg.overrideScope hls_overlay)) {
124 haskell-language-server = allowInconsistentDependencies super.haskell-language-server;
125 # Tests fail due to the newly-build fourmolu not being in PATH
126 # https://github.com/fourmolu/fourmolu/issues/231
127 fourmolu = dontCheck super.fourmolu_0_14_0_0;
128 ormolu = self.generateOptparseApplicativeCompletions [ "ormolu" ] (enableSeparateBinOutput super.ormolu_0_7_2_0);
129 hlint = super.hlint_3_6_1;
130 stylish-haskell = super.stylish-haskell;
133 haskell-language-server
134 # HLS from 2.3 needs at least formolu 0.14.
135 # This means we need to bump a lot of other tools, too, because they all us ghc-lib-parser
136 # We do this globally to prevent inconsistent formatting or lints between hls and the command line tools.