Clone of https://github.com/NixOS/nixpkgs.git (to stress-test knotserver)
1{ pkgs, haskellLib }:
2
3self: super:
4
5with haskellLib;
6
7let
8 inherit (pkgs) lib;
9
10 warnAfterVersion =
11 ver: pkg:
12 lib.warnIf (lib.versionOlder ver
13 super.${pkg.pname}.version
14 ) "override for haskell.packages.ghc96.${pkg.pname} may no longer be needed" pkg;
15
16in
17
18{
19 llvmPackages = lib.dontRecurseIntoAttrs self.ghc.llvmPackages;
20
21 # Disable GHC core libraries
22 array = null;
23 base = null;
24 binary = null;
25 bytestring = null;
26 Cabal = null;
27 Cabal-syntax = null;
28 containers = null;
29 deepseq = null;
30 directory = null;
31 exceptions = null;
32 filepath = null;
33 ghc-bignum = null;
34 ghc-boot = null;
35 ghc-boot-th = null;
36 ghc-compact = null;
37 ghc-heap = null;
38 ghc-prim = null;
39 ghci = null;
40 haskeline = null;
41 hpc = null;
42 integer-gmp = null;
43 libiserv = null;
44 mtl = null;
45 parsec = null;
46 pretty = null;
47 process = null;
48 rts = null;
49 stm = null;
50 system-cxx-std-lib = null;
51 template-haskell = null;
52 # terminfo is not built if GHC is a cross compiler
53 terminfo =
54 if pkgs.stdenv.hostPlatform == pkgs.stdenv.buildPlatform then
55 null
56 else
57 doDistribute self.terminfo_0_4_1_7;
58 text = null;
59 time = null;
60 transformers = null;
61 unix = null;
62 xhtml = null;
63
64 # Becomes a core package in GHC >= 9.8
65 semaphore-compat = doDistribute self.semaphore-compat_1_0_0;
66
67 # Needs base-orphans for GHC < 9.8 / base < 4.19
68 some = addBuildDepend self.base-orphans super.some;
69
70 #
71 # Version deviations from Stackage LTS
72 #
73
74 # Too strict upper bound on template-haskell
75 # https://github.com/mokus0/th-extras/pull/21
76 th-extras = doJailbreak super.th-extras;
77
78 # not in Stackage, needs to match ghc-lib
79 # since expression is generated for 9.8, ghc-lib dep needs to be added manually
80 ghc-tags = doDistribute (addBuildDepends [ self.ghc-lib ] self.ghc-tags_1_8);
81
82 #
83 # Too strict bounds without upstream fix
84 #
85
86 # Forbids transformers >= 0.6
87 quickcheck-classes-base = doJailbreak super.quickcheck-classes-base;
88 # https://github.com/Gabriella439/Haskell-Break-Library/pull/3
89 break = doJailbreak super.break;
90 # Forbids mtl >= 2.3
91 ChasingBottoms = doJailbreak super.ChasingBottoms;
92 # Forbids base >= 4.18
93 cabal-install-solver = doJailbreak super.cabal-install-solver;
94 cabal-install = doJailbreak super.cabal-install;
95
96 # Forbids base >= 4.18, fix proposed: https://github.com/sjakobi/newtype-generics/pull/25
97 newtype-generics = warnAfterVersion "0.6.2" (doJailbreak super.newtype-generics);
98
99 # Jailbreaks for servant <0.20
100 servant-lucid = doJailbreak super.servant-lucid;
101
102 stm-containers = dontCheck super.stm-containers;
103 regex-tdfa = dontCheck super.regex-tdfa;
104 hiedb = dontCheck super.hiedb;
105 retrie = dontCheck super.retrie;
106 # https://github.com/kowainik/relude/issues/436
107 relude = dontCheck (doJailbreak super.relude);
108
109 inherit (pkgs.lib.mapAttrs (_: doJailbreak) super)
110 ghc-trace-events
111 gi-cairo-connector # mtl <2.3
112 ghc-prof # base <4.18
113 env-guard # doctest <0.21
114 package-version # doctest <0.21, tasty-hedgehog <1.4
115 ;
116
117 # Pending text-2.0 support https://github.com/gtk2hs/gtk2hs/issues/327
118 gtk = doJailbreak super.gtk;
119
120 # 2023-12-23: It needs this to build under ghc-9.6.3.
121 # A factor of 100 is insufficient, 200 seems seems to work.
122 hip = appendConfigureFlag "--ghc-options=-fsimpl-tick-factor=200" super.hip;
123
124 # This can be removed once https://github.com/typeclasses/ascii-predicates/pull/1
125 # is merged and in a release that's being tracked.
126 ascii-predicates = appendPatch (pkgs.fetchpatch {
127 url = "https://github.com/typeclasses/ascii-predicates/commit/2e6d9ed45987a8566f3a77eedf7836055c076d1a.patch";
128 name = "ascii-predicates-pull-1.patch";
129 relative = "ascii-predicates";
130 sha256 = "sha256-4JguQFZNRQpjZThLrAo13jNeypvLfqFp6o7c1bnkmZo=";
131 }) super.ascii-predicates;
132
133 # This can be removed once https://github.com/typeclasses/ascii-numbers/pull/1
134 # is merged and in a release that's being tracked.
135 ascii-numbers = appendPatch (pkgs.fetchpatch {
136 url = "https://github.com/typeclasses/ascii-numbers/commit/e9474ad91bc997891f1a46afd5d0bdf9b9f7d768.patch";
137 name = "ascii-numbers-pull-1.patch";
138 relative = "ascii-numbers";
139 sha256 = "sha256-buw1UeW57CFefEfqdDUraSyQ+H/NvCZOv6WF2ORiYQg=";
140 }) super.ascii-numbers;
141
142 # Tests require nothunks < 0.3 (conflicting with Stackage) for GHC < 9.8
143 aeson = dontCheck super.aeson;
144
145 # Apply patch from PR with mtl-2.3 fix.
146 ConfigFile = overrideCabal (drv: {
147 editedCabalFile = null;
148 buildDepends = drv.buildDepends or [ ] ++ [ self.HUnit ];
149 patches = [
150 (pkgs.fetchpatch {
151 # https://github.com/jgoerzen/configfile/pull/12
152 name = "ConfigFile-pr-12.patch";
153 url = "https://github.com/jgoerzen/configfile/compare/d0a2e654be0b73eadbf2a50661d00574ad7b6f87...83ee30b43f74d2b6781269072cf5ed0f0e00012f.patch";
154 sha256 = "sha256-b7u9GiIAd2xpOrM0MfILHNb6Nt7070lNRIadn2l3DfQ=";
155 })
156 ];
157 }) super.ConfigFile;
158
159 # https://github.com/NixOS/nixpkgs/pull/367998#issuecomment-2598941240
160 libtorch-ffi-helper = unmarkBroken (doDistribute super.libtorch-ffi-helper);
161
162 # Compatibility with core libs of GHC 9.6
163 # Jailbreak to lift bound on time
164 kqueue = doJailbreak (
165 appendPatches [
166 (pkgs.fetchpatch {
167 name = "kqueue-ghc-9.6.patch";
168 url = "https://github.com/hesselink/kqueue/pull/10/commits/a2735e807d761410e776482ec04515d9cf76a7f5.patch";
169 sha256 = "18rilz4nrwcmlvll3acjx2lp7s129pviggb8fy3hdb0z34ls5j84";
170 excludes = [ ".gitignore" ];
171 })
172 ] super.kqueue
173 );
174
175 # This runs into the following GHC bug currently affecting 9.6.* and 9.8.* as
176 # well as 9.10.1: https://gitlab.haskell.org/ghc/ghc/-/issues/24432
177 inherit
178 (lib.mapAttrs (
179 _:
180 overrideCabal (drv: {
181 badPlatforms = drv.badPlatforms or [ ] ++ [ "aarch64-linux" ];
182 })
183 ) super)
184 mueval
185 lambdabot
186 lambdabot-haskell-plugins
187 ;
188
189 singletons-base = dontCheck super.singletons-base;
190
191 # A given major version of ghc-exactprint only supports one version of GHC.
192 ghc-exactprint = addBuildDepend self.extra super.ghc-exactprint_1_7_1_0;
193}
194# super.ghc is required to break infinite recursion as Nix is strict in the attrNames
195//
196 lib.optionalAttrs (pkgs.stdenv.hostPlatform.isAarch64 && lib.versionOlder super.ghc.version "9.6.4")
197 {
198 # The NCG backend for aarch64 generates invalid jumps in some situations,
199 # the workaround on 9.6 is to revert to the LLVM backend (which is used
200 # for these sorts of situations even on 9.2 and 9.4).
201 # https://gitlab.haskell.org/ghc/ghc/-/issues/23746#note_525318
202 inherit (lib.mapAttrs (_: self.forceLlvmCodegenBackend) super)
203 tls
204 mmark
205 ;
206 }