6 inherit (pkgs.stdenv.hostPlatform) isDarwin;
11 llvmPackages = pkgs.lib.dontRecurseIntoAttrs self.ghc.llvmPackages;
13 # Disable GHC 8.10.x core libraries.
40 template-haskell = null;
41 # GHC only builds terminfo if it is a native compiler
42 terminfo = if pkgs.stdenv.hostPlatform == pkgs.stdenv.buildPlatform then null else self.terminfo_0_4_1_6;
47 # GHC only bundles the xhtml library if haddock is enabled, check if this is
48 # still the case when updating: https://gitlab.haskell.org/ghc/ghc/-/blob/0198841877f6f04269d6050892b98b5c3807ce4c/ghc.mk#L463
49 xhtml = if self.ghc.hasHaddock or true then null else self.xhtml_3000_3_0_0;
51 # Need the Cabal-syntax-3.6.0.0 fake package for Cabal < 3.8 to allow callPackage and the constraint solver to work
52 Cabal-syntax = self.Cabal-syntax_3_6_0_0;
53 # These core package only exist for GHC >= 9.4. The best we can do is feign
54 # their existence to callPackages, but their is no shim for lower GHC versions.
55 system-cxx-std-lib = null;
57 # Additionally depends on OneTuple for GHC < 9.0
58 base-compat-batteries = addBuildDepend self.OneTuple super.base-compat-batteries;
60 # For GHC < 9.4, some packages need data-array-byte as an extra dependency
61 primitive = addBuildDepends [ self.data-array-byte ] super.primitive;
62 hashable = addBuildDepends [
67 # Pick right versions for GHC-specific packages
68 ghc-api-compat = doDistribute (unmarkBroken self.ghc-api-compat_8_10_7);
70 # Needs to use ghc-lib due to incompatible GHC
71 ghc-tags = doDistribute (addBuildDepend self.ghc-lib self.ghc-tags_1_5);
73 # Jailbreak to fix the build.
74 base-noprelude = doJailbreak super.base-noprelude;
75 unliftio-core = doJailbreak super.unliftio-core;
77 # Jailbreaking because monoidal-containers hasn’t bumped it's base dependency for 8.10.
78 monoidal-containers = doJailbreak super.monoidal-containers;
80 # Jailbreak to fix the build.
81 brick = doJailbreak super.brick;
82 exact-pi = doJailbreak super.exact-pi;
83 serialise = doJailbreak super.serialise;
84 setlocale = doJailbreak super.setlocale;
85 shellmet = doJailbreak super.shellmet;
86 shower = doJailbreak super.shower;
88 # Apply patch from https://github.com/finnsson/template-helper/issues/12#issuecomment-611795375 to fix the build.
89 language-haskell-extract = appendPatch (pkgs.fetchpatch {
90 name = "language-haskell-extract-0.2.4.patch";
91 url = "https://gitlab.haskell.org/ghc/head.hackage/-/raw/e48738ee1be774507887a90a0d67ad1319456afc/patches/language-haskell-extract-0.2.4.patch?inline=false";
92 sha256 = "0rgzrq0513nlc1vw7nw4km4bcwn4ivxcgi33jly4a7n3c1r32v1f";
93 }) (doJailbreak super.language-haskell-extract);
95 # hnix 0.9.0 does not provide an executable for ghc < 8.10, so define completions here for now.
96 hnix = self.generateOptparseApplicativeCompletions [ "hnix" ]
97 (overrideCabal (drv: {
98 # executable is allowed for ghc >= 8.10 and needs repline
99 executableHaskellDepends = drv.executableToolDepends or [] ++ [ self.repline ];
102 haskell-language-server = let
103 # These aren't included in hackage-packages.nix because hackage2nix is configured for GHC 9.2, under which these plugins aren't supported.
104 # See https://github.com/NixOS/nixpkgs/pull/205902 for why we use `self.<package>.scope`
105 additionalDeps = with self.haskell-language-server.scope; [
106 hls-haddock-comments-plugin
107 (unmarkBroken hls-splice-plugin)
110 in addBuildDepends additionalDeps (super.haskell-language-server.overrideScope (lself: lsuper: {
111 Cabal = lself.Cabal_3_6_3_0;
112 aeson = lself.aeson_1_5_6_0;
113 lens-aeson = doJailbreak lself.lens-aeson_1_1_3;
114 lsp-types = dontCheck (doJailbreak lsuper.lsp-types); # Checks require aeson >= 2.0
115 hls-overloaded-record-dot-plugin = null;
118 ghc-lib-parser = doDistribute self.ghc-lib-parser_9_2_8_20230729;
119 ghc-lib-parser-ex = doDistribute self.ghc-lib-parser-ex_9_2_1_1;
120 ghc-lib = doDistribute self.ghc-lib_9_2_8_20230729;
122 mod = super.mod_0_1_2_2;
123 path-io = doJailbreak super.path-io;
125 hls-cabal-plugin = super.hls-cabal-plugin.override {
126 Cabal-syntax = self.Cabal-syntax_3_8_1_0;
129 ormolu = self.ormolu_0_5_0_1;
130 fourmolu = dontCheck self.fourmolu_0_9_0_0;
131 hlint = self.hlint_3_4_1;
132 stylish-haskell = doJailbreak self.stylish-haskell_0_14_3_0;
134 hls-tactics-plugin = unmarkBroken (addBuildDepends (with self.hls-tactics-plugin.scope; [
135 aeson extra fingertree generic-lens ghc-exactprint ghc-source-gen ghcide
136 hls-graph hls-plugin-api hls-refactor-plugin hyphenation lens lsp megaparsec
137 parser-combinators prettyprinter refinery retrie syb unagi-chan unordered-containers
138 ]) super.hls-tactics-plugin);
140 # This package is marked as unbuildable on GHC 9.2, so hackage2nix doesn't include any dependencies.
141 # See https://github.com/NixOS/nixpkgs/pull/205902 for why we use `self.<package>.scope`
142 hls-haddock-comments-plugin = unmarkBroken (addBuildDepends (with self.hls-haddock-comments-plugin.scope; [
143 ghc-exactprint ghcide hls-plugin-api hls-refactor-plugin lsp-types unordered-containers
144 ]) super.hls-haddock-comments-plugin);
146 mime-string = disableOptimization super.mime-string;
148 # weeder 2.3.* no longer supports GHC 8.10
149 weeder = doDistribute (doJailbreak self.weeder_2_2_0);
150 # Unnecessarily strict upper bound on lens
151 weeder_2_2_0 = doJailbreak (super.weeder_2_2_0.override {
152 # weeder < 2.6 only supports algebraic-graphs < 0.7
153 # We no longer have matching test deps for algebraic-graphs 0.6.1 in the set
154 algebraic-graphs = dontCheck self.algebraic-graphs_0_6_1;
157 # OneTuple needs hashable (instead of ghc-prim) and foldable1-classes-compat for GHC < 9
158 OneTuple = addBuildDepends [
159 self.foldable1-classes-compat
160 ] (super.OneTuple.override {
161 ghc-prim = self.hashable;
164 # Doesn't build with 9.0, see https://github.com/yi-editor/yi/issues/1125
165 yi-core = doDistribute (markUnbroken super.yi-core);
167 # Temporarily disabled blaze-textual for GHC >= 9.0 causing hackage2nix ignoring it
168 # https://github.com/paul-rouse/mysql-simple/blob/872604f87044ff6d1a240d9819a16c2bdf4ed8f5/Database/MySQL/Internal/Blaze.hs#L4-L10
169 mysql-simple = addBuildDepends [
171 ] super.mysql-simple;
173 taffybar = markUnbroken (doDistribute super.taffybar);
175 # https://github.com/fpco/inline-c/issues/127 (recommend to upgrade to Nixpkgs GHC >=9.0)
176 inline-c-cpp = (if isDarwin then dontCheck else x: x) super.inline-c-cpp;
178 # Depends on OneTuple for GHC < 9.0
179 universe-base = addBuildDepends [ self.OneTuple ] super.universe-base;
181 # Not possible to build in the main GHC 9.0 package set
182 # https://github.com/awakesecurity/spectacle/issues/49
183 spectacle = doDistribute (markUnbroken super.spectacle);
185 # doctest-parallel dependency requires newer Cabal
186 regex-tdfa = dontCheck super.regex-tdfa;
188 # Unnecessarily strict lower bound on base
189 # https://github.com/mrkkrp/megaparsec/pull/485#issuecomment-1250051823
190 megaparsec = doJailbreak super.megaparsec;
192 retrie = dontCheck self.retrie_1_1_0_0;
194 # Later versions only support GHC >= 9.2
195 ghc-exactprint = self.ghc-exactprint_0_6_4;
197 apply-refact = self.apply-refact_0_9_3_0;
199 hls-hlint-plugin = super.hls-hlint-plugin.override {
200 inherit (self) apply-refact;
203 # Needs OneTuple for ghc < 9.2
204 binary-orphans = addBuildDepends [ self.OneTuple ] super.binary-orphans;
207 ghc-source-gen = doDistribute (unmarkBroken super.ghc-source-gen);