Clone of https://github.com/NixOS/nixpkgs.git (to stress-test knotserver)
at devShellTools-shell 230 lines 7.6 kB view raw
1{ pkgs, haskellLib }: 2 3with haskellLib; 4 5let 6 inherit (pkgs.stdenv.hostPlatform) isDarwin; 7 inherit (pkgs) lib; 8in 9 10self: super: { 11 12 # ghcjs does not use `llvmPackages` and exposes `null` attribute. 13 llvmPackages = 14 if self.ghc.llvmPackages != null then pkgs.lib.dontRecurseIntoAttrs self.ghc.llvmPackages else null; 15 16 # Disable GHC 8.10.x core libraries. 17 array = null; 18 base = null; 19 binary = null; 20 bytestring = null; 21 Cabal = null; 22 containers = null; 23 deepseq = null; 24 directory = null; 25 exceptions = null; 26 filepath = null; 27 ghc-boot = null; 28 ghc-boot-th = null; 29 ghc-compact = null; 30 ghc-heap = null; 31 ghc-prim = null; 32 ghci = null; 33 haskeline = null; 34 hpc = null; 35 integer-gmp = null; 36 libiserv = null; 37 mtl = null; 38 parsec = null; 39 pretty = null; 40 process = null; 41 rts = null; 42 stm = null; 43 template-haskell = null; 44 # GHC only builds terminfo if it is a native compiler 45 terminfo = 46 if pkgs.stdenv.hostPlatform == pkgs.stdenv.buildPlatform then 47 null 48 else 49 doDistribute self.terminfo_0_4_1_7; 50 text = null; 51 time = null; 52 transformers = null; 53 unix = null; 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 doDistribute self.xhtml_3000_4_0_0; 57 58 # Need the Cabal-syntax-3.6.0.0 fake package for Cabal < 3.8 to allow callPackage and the constraint solver to work 59 Cabal-syntax = self.Cabal-syntax_3_6_0_0; 60 # These core package only exist for GHC >= 9.4. The best we can do is feign 61 # their existence to callPackages, but their is no shim for lower GHC versions. 62 system-cxx-std-lib = null; 63 64 # Becomes a core package in GHC >= 9.8 65 semaphore-compat = doDistribute self.semaphore-compat_1_0_0; 66 67 # only broken for >= 9.6 68 calligraphy = doDistribute (unmarkBroken super.calligraphy); 69 70 # Only required for ghc >= 9.2 71 nothunks = super.nothunks.override { 72 wherefrom-compat = null; 73 }; 74 75 # Tests require nothunks < 0.3 (conflicting with Stackage) for GHC < 9.8 76 aeson = dontCheck super.aeson; 77 78 # For GHC < 9.4, some packages need data-array-byte as an extra dependency 79 # For GHC < 9.2, os-string is not required. 80 primitive = addBuildDepends [ self.data-array-byte ] super.primitive; 81 hashable = 82 addBuildDepends 83 [ 84 self.data-array-byte 85 self.base-orphans 86 ] 87 ( 88 super.hashable.override { 89 os-string = null; 90 } 91 ); 92 hashable-time = doDistribute (unmarkBroken super.hashable-time); 93 94 # Needs base-orphans for GHC < 9.8 / base < 4.19 95 some = addBuildDepend self.base-orphans super.some; 96 97 # Too strict lower bounds on base 98 primitive-addr = doJailbreak super.primitive-addr; 99 100 # Pick right versions for GHC-specific packages 101 ghc-api-compat = doDistribute (unmarkBroken self.ghc-api-compat_8_10_7); 102 103 # Needs to use ghc-lib due to incompatible GHC 104 ghc-tags = doDistribute self.ghc-tags_1_5; 105 106 # Jailbreak to fix the build. 107 base-noprelude = doJailbreak super.base-noprelude; 108 unliftio-core = doJailbreak super.unliftio-core; 109 110 # Jailbreak to fix the build. 111 brick = doJailbreak super.brick; 112 exact-pi = doJailbreak super.exact-pi; 113 serialise = doJailbreak super.serialise; 114 setlocale = doJailbreak super.setlocale; 115 shellmet = doJailbreak super.shellmet; 116 shower = doJailbreak super.shower; 117 118 # hnix 0.9.0 does not provide an executable for ghc < 8.10, so define completions here for now. 119 hnix = self.generateOptparseApplicativeCompletions [ "hnix" ] ( 120 overrideCabal (drv: { 121 # executable is allowed for ghc >= 8.10 and needs repline 122 executableHaskellDepends = drv.executableToolDepends or [ ] ++ [ self.repline ]; 123 }) super.hnix 124 ); 125 126 haskell-language-server = throw "haskell-language-server dropped support for ghc 8.10 in version 2.3.0.0 please use a newer ghc version or an older nixpkgs version"; 127 128 ghc-lib-parser = doDistribute self.ghc-lib-parser_9_2_8_20230729; 129 ghc-lib-parser-ex = doDistribute self.ghc-lib-parser-ex_9_2_1_1; 130 ghc-lib = doDistribute self.ghc-lib_9_2_8_20230729; 131 132 path-io = doJailbreak super.path-io; 133 134 hlint = self.hlint_3_4_1; 135 136 mime-string = disableOptimization super.mime-string; 137 138 # weeder 2.3.* no longer supports GHC 8.10 139 weeder = doDistribute (doJailbreak self.weeder_2_2_0); 140 # Unnecessarily strict upper bound on lens 141 weeder_2_2_0 = doJailbreak ( 142 super.weeder_2_2_0.override { 143 # weeder < 2.6 only supports algebraic-graphs < 0.7 144 # We no longer have matching test deps for algebraic-graphs 0.6.1 in the set 145 algebraic-graphs = dontCheck self.algebraic-graphs_0_6_1; 146 } 147 ); 148 149 # Uses haddock placement that isn't supported by the versions of haddock 150 # bundled with GHC < 9.0. 151 wai-extra = dontHaddock super.wai-extra; 152 153 # tar > 0.6 requires os-string which can't be built with bytestring < 0.11 154 tar = overrideCabal (drv: { 155 jailbreak = true; 156 buildDepends = drv.buildDepends or [ ] ++ [ 157 self.bytestring-handle 158 ]; 159 }) self.tar_0_6_0_0; 160 # text-metrics >= 0.3.3 requires GHC2021 161 text-metrics = doDistribute (doJailbreak self.text-metrics_0_3_2); 162 bytestring-handle = unmarkBroken (doDistribute super.bytestring-handle); 163 164 # Doesn't build with 9.0, see https://github.com/yi-editor/yi/issues/1125 165 yi-core = doDistribute (markUnbroken super.yi-core); 166 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 [ 170 self.blaze-textual 171 ] super.mysql-simple; 172 173 taffybar = markUnbroken (doDistribute super.taffybar); 174 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; 177 178 # Depends on OneTuple for GHC < 9.0 179 universe-base = addBuildDepends [ self.OneTuple ] super.universe-base; 180 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); 184 185 # doctest-parallel dependency requires newer Cabal 186 regex-tdfa = dontCheck super.regex-tdfa; 187 188 # Unnecessarily strict lower bound on base 189 # https://github.com/mrkkrp/megaparsec/pull/485#issuecomment-1250051823 190 megaparsec = doJailbreak super.megaparsec; 191 192 retrie = dontCheck self.retrie_1_1_0_0; 193 194 # Later versions only support GHC >= 9.2 195 ghc-exactprint = self.ghc-exactprint_0_6_4; 196 197 apply-refact = self.apply-refact_0_9_3_0; 198 199 # Needs OneTuple for ghc < 9.2 200 binary-orphans = addBuildDepends [ self.OneTuple ] super.binary-orphans; 201 202 # 0.4.6.0 only supports >= 9.0 203 ghc-source-gen = doDistribute self.ghc-source-gen_0_4_5_0; 204 205 # No instance for (Show B.Builder) arising from a use of ‘print’ 206 http-types = dontCheck super.http-types; 207 208 # Packages which need compat library for GHC < 9.6 209 inherit (lib.mapAttrs (_: addBuildDepends [ self.foldable1-classes-compat ]) super) 210 indexed-traversable 211 these 212 ; 213 base-compat-batteries = addBuildDepends [ 214 self.foldable1-classes-compat 215 self.OneTuple 216 ] super.base-compat-batteries; 217 218 # OneTuple needs hashable (instead of ghc-prim) and foldable1-classes-compat for GHC < 9 219 OneTuple = 220 addBuildDepends 221 [ 222 self.foldable1-classes-compat 223 self.base-orphans 224 ] 225 ( 226 super.OneTuple.override { 227 ghc-prim = self.hashable; 228 } 229 ); 230}