Clone of https://github.com/NixOS/nixpkgs.git (to stress-test knotserver)
1{
2 config,
3 pkgs,
4 haskellLib,
5}:
6
7with haskellLib;
8
9let
10 inherit (pkgs.stdenv.hostPlatform) isDarwin;
11 inherit (pkgs) lib;
12in
13
14self: super: {
15
16 llvmPackages = pkgs.lib.dontRecurseIntoAttrs self.ghc.llvmPackages;
17
18 # Disable GHC 9.2.x core libraries.
19 array = null;
20 base = null;
21 binary = null;
22 bytestring = null;
23 Cabal = null;
24 containers = null;
25 deepseq = null;
26 directory = null;
27 exceptions = null;
28 filepath = null;
29 ghc-bignum = null;
30 ghc-boot = null;
31 ghc-boot-th = null;
32 ghc-compact = null;
33 ghc-heap = null;
34 ghc-prim = null;
35 ghci = null;
36 haskeline = null;
37 hpc = null;
38 integer-gmp = null;
39 libiserv = null;
40 mtl = null;
41 parsec = null;
42 pretty = null;
43 process = null;
44 rts = null;
45 stm = null;
46 template-haskell = null;
47 # GHC only builds terminfo if it is a native compiler
48 terminfo =
49 if pkgs.stdenv.hostPlatform == pkgs.stdenv.buildPlatform then
50 null
51 else
52 doDistribute self.terminfo_0_4_1_7;
53 text = null;
54 time = null;
55 transformers = null;
56 unix = null;
57 # GHC only bundles the xhtml library if haddock is enabled, check if this is
58 # still the case when updating: https://gitlab.haskell.org/ghc/ghc/-/blob/0198841877f6f04269d6050892b98b5c3807ce4c/ghc.mk#L463
59 xhtml = if self.ghc.hasHaddock or true then null else doDistribute self.xhtml_3000_4_0_0;
60
61 # Need the Cabal-syntax-3.6.0.0 fake package for Cabal < 3.8 to allow callPackage and the constraint solver to work
62 Cabal-syntax = self.Cabal-syntax_3_6_0_0;
63 # These core package only exist for GHC >= 9.4. The best we can do is feign
64 # their existence to callPackages, but their is no shim for lower GHC versions.
65 system-cxx-std-lib = null;
66
67 # Becomes a core package in GHC >= 9.8
68 semaphore-compat = doDistribute self.semaphore-compat_1_0_0;
69
70 # weeder >= 2.5 requires GHC 9.4
71 weeder = doDistribute self.weeder_2_4_1;
72 # Allow dhall 1.42.*
73 weeder_2_4_1 = doJailbreak (
74 super.weeder_2_4_1.override {
75 # weeder < 2.6 only supports algebraic-graphs < 0.7
76 # We no longer have matching test deps for algebraic-graphs 0.6.1 in the set
77 algebraic-graphs = dontCheck self.algebraic-graphs_0_6_1;
78 }
79 );
80
81 haskell-language-server =
82 lib.throwIf config.allowAliases
83 "haskell-language-server has dropped support for ghc 9.2 in version 2.10.0.0, please use a newer ghc version or an older nixpkgs version"
84 (markBroken super.haskell-language-server);
85
86 # For GHC < 9.4, some packages need data-array-byte as an extra dependency
87 hashable = addBuildDepends [ self.data-array-byte ] super.hashable;
88 primitive = addBuildDepends [ self.data-array-byte ] super.primitive;
89 primitive-unlifted = super.primitive-unlifted_0_1_3_1;
90 # Too strict lower bound on base
91 primitive-addr = doJailbreak super.primitive-addr;
92
93 # Needs base-orphans for GHC < 9.8 / base < 4.19
94 some = addBuildDepend self.base-orphans super.some;
95
96 # Jailbreaks & Version Updates
97 hashable-time = doJailbreak super.hashable-time;
98
99 # Depends on utf8-light which isn't maintained / doesn't support base >= 4.16
100 # https://github.com/haskell-infra/hackage-trustees/issues/347
101 # https://mail.haskell.org/pipermail/haskell-cafe/2022-October/135613.html
102 language-javascript_0_7_0_0 = dontCheck super.language-javascript_0_7_0_0;
103
104 # Needs to match ghc-lib version
105 ghc-tags = doDistribute (doJailbreak self.ghc-tags_1_7);
106
107 # Needs to match ghc-lib
108 hlint = doDistribute self.hlint_3_6_1;
109
110 # ghc-lib >= 9.8 and friends no longer build with GHC 9.2 since they require semaphore-compat
111 ghc-lib-parser = doDistribute (
112 self.ghc-lib-parser_9_6_7_20250325.override {
113 happy = self.happy_1_20_1_1; # wants happy < 1.21
114 }
115 );
116 ghc-lib-parser-ex = doDistribute self.ghc-lib-parser-ex_9_6_0_2;
117 ghc-lib = doDistribute (
118 self.ghc-lib_9_6_7_20250325.override {
119 happy = self.happy_1_20_1_1; # wants happy < 1.21
120 }
121 );
122
123 # 0.2.2.3 requires Cabal >= 3.8
124 shake-cabal = doDistribute self.shake-cabal_0_2_2_2;
125
126 # Tests require nothunks < 0.3 (conflicting with Stackage) for GHC < 9.8
127 aeson = dontCheck super.aeson;
128
129 # https://github.com/NixOS/cabal2nix/issues/554
130 # https://github.com/clash-lang/clash-compiler/blob/f0f6275e19b8c672f042026c478484c5fd45191d/README.md#ghc-compatibility
131 clash-prelude = dontDistribute (markBroken super.clash-prelude);
132
133 # Too strict upper bound on bytestring, relevant for GHC 9.2.6 specifically
134 # https://github.com/protolude/protolude/issues/127#issuecomment-1428807874
135 protolude = doJailbreak super.protolude;
136
137 # https://github.com/fpco/inline-c/pull/131
138 inline-c-cpp =
139 (if isDarwin then appendConfigureFlags [ "--ghc-option=-fcompact-unwind" ] else x: x)
140 super.inline-c-cpp;
141
142 # A given major version of ghc-exactprint only supports one version of GHC.
143 ghc-exactprint = super.ghc-exactprint_1_5_0;
144
145 # only broken for >= 9.6
146 calligraphy = doDistribute (unmarkBroken super.calligraphy);
147
148 # Packages which need compat library for GHC < 9.6
149 inherit (lib.mapAttrs (_: addBuildDepends [ self.foldable1-classes-compat ]) super)
150 indexed-traversable
151 OneTuple
152 these
153 ;
154 base-compat-batteries = addBuildDepends [
155 self.foldable1-classes-compat
156 self.OneTuple
157 ] super.base-compat-batteries;
158}