at master 70 kB view raw
1# NIX-SPECIFIC OVERRIDES/PATCHES FOR HASKELL PACKAGES 2# 3# This file contains overrides which are needed because of Nix. For example, 4# some packages may need help finding the location of native libraries. In 5# general, overrides in this file are (mostly) due to one of the following reasons: 6# 7# * packages that hard code the location of native libraries, so they need to be patched/ 8# supplied the patch explicitly 9# * passing native libraries that are not detected correctly by cabal2nix 10# * test suites that fail due to some features not available in the nix sandbox 11# (networking being a common one) 12# 13# In general, this file should *not* contain overrides that fix build failures that could 14# also occur on standard, FHS-compliant non-Nix systems. For example, if tests have a compile 15# error, that is a bug in the package, and that failure has nothing to do with Nix. 16# 17# Common examples which should *not* be a part of this file: 18# 19# * overriding a specific version of a haskell library because some package fails 20# to build with a newer version. Such overrides have nothing to do with Nix itself, 21# and they would also be necessary outside of Nix if you use the same set of 22# package versions. 23# * disabling tests that fail due to missing files in the tarball or compile errors 24# * disabling tests that require too much memory 25# * enabling/disabling certain features in packages 26# 27# If you have an override of this kind, see configuration-common.nix instead. 28{ pkgs, haskellLib }: 29 30let 31 inherit (pkgs) lib; 32in 33 34with haskellLib; 35 36# All of the overrides in this set should look like: 37# 38# foo = ... something involving super.foo ... 39# 40# but that means that we add `foo` attribute even if there is no `super.foo`! So if 41# you want to use this configuration for a package set that only contains a subset of 42# the packages that have overrides defined here, you'll end up with a set that contains 43# a bunch of attributes that trigger an evaluation error. 44# 45# To avoid this, we use `intersectAttrs` here so we never add packages that are not present 46# in the parent package set (`super`). 47 48# To avoid merge conflicts, consider adding your item at an arbitrary place in the list instead. 49self: super: 50builtins.intersectAttrs super { 51 52 # Apply NixOS-specific patches. 53 ghc-paths = appendPatch ./patches/ghc-paths-nix.patch super.ghc-paths; 54 55 ####################################### 56 ### HASKELL-LANGUAGE-SERVER SECTION ### 57 ####################################### 58 59 cabal-add = overrideCabal (drv: { 60 # tests depend on executable 61 preCheck = ''export PATH="$PWD/dist/build/cabal-add:$PATH"''; 62 }) super.cabal-add; 63 64 haskell-language-server = overrideCabal (drv: { 65 # starting with 1.6.1.1 haskell-language-server wants to be linked dynamically 66 # by default. Unless we reflect this in the generic builder, GHC is going to 67 # produce some illegal references to /build/. 68 enableSharedExecutables = true; 69 # The shell script wrapper checks that the runtime ghc and its boot packages match the ghc hls was compiled with. 70 # This prevents linking issues when running TH splices. 71 postInstall = '' 72 mv "$out/bin/haskell-language-server" "$out/bin/.haskell-language-server-${self.ghc.version}-unwrapped" 73 BOOT_PKGS="ghc-${self.ghc.version} template-haskell-$(ghc-pkg-${self.ghc.version} --global --simple-output field template-haskell version)" 74 ${pkgs.buildPackages.gnused}/bin/sed \ 75 -e "s!@@EXE_DIR@@!$out/bin!" \ 76 -e "s/@@EXE_NAME@@/.haskell-language-server-${self.ghc.version}-unwrapped/" \ 77 -e "s/@@GHC_VERSION@@/${self.ghc.version}/" \ 78 -e "s/@@BOOT_PKGS@@/$BOOT_PKGS/" \ 79 -e "s/@@ABI_HASHES@@/$(for dep in $BOOT_PKGS; do printf "%s:" "$dep" && ghc-pkg-${self.ghc.version} field $dep abi --simple-output ; done | tr '\n' ' ' | xargs)/" \ 80 -e "s!Consider installing ghc.* via ghcup or build HLS from source.!Visit https://nixos.org/manual/nixpkgs/unstable/#haskell-language-server to learn how to correctly install a matching hls for your ghc with nix.!" \ 81 bindist/wrapper.in > "$out/bin/haskell-language-server" 82 ln -s "$out/bin/haskell-language-server" "$out/bin/haskell-language-server-${self.ghc.version}" 83 chmod +x "$out/bin/haskell-language-server" 84 ''; 85 testToolDepends = [ 86 self.cabal-install 87 pkgs.git 88 ]; 89 testTargets = [ "func-test" ]; # wrapper test accesses internet 90 preCheck = '' 91 export PATH=$PATH:$PWD/dist/build/haskell-language-server:$PWD/dist/build/haskell-language-server-wrapper 92 export HOME=$TMPDIR 93 ''; 94 }) super.haskell-language-server; 95 96 # ghcide-bench tests need network 97 ghcide-bench = dontCheck super.ghcide-bench; 98 99 # 2023-04-01: TODO: Either reenable at least some tests or remove the preCheck override 100 ghcide = overrideCabal (drv: { 101 # tests depend on executable 102 preCheck = ''export PATH="$PWD/dist/build/ghcide:$PATH"''; 103 }) super.ghcide; 104 105 hiedb = overrideCabal (drv: { 106 preCheck = '' 107 export PATH=$PWD/dist/build/hiedb:$PATH 108 ''; 109 }) super.hiedb; 110 111 # Tests access homeless-shelter. 112 hie-bios = dontCheck super.hie-bios; 113 114 ########################################### 115 ### END HASKELL-LANGUAGE-SERVER SECTION ### 116 ########################################### 117 118 # Test suite needs executable 119 agda2lagda = overrideCabal (drv: { 120 preCheck = '' 121 export PATH="$PWD/dist/build/agda2lagda:$PATH" 122 '' 123 + drv.preCheck or ""; 124 }) super.agda2lagda; 125 126 # scrypt requires SSE2 127 password = super.password.override ( 128 lib.optionalAttrs (!(lib.meta.availableOn pkgs.stdenv.hostPlatform self.scrypt)) { 129 scrypt = null; 130 } 131 ); 132 133 audacity = enableCabalFlag "buildExamples" ( 134 overrideCabal (drv: { 135 executableHaskellDepends = [ 136 self.optparse-applicative 137 self.soxlib 138 ]; 139 }) super.audacity 140 ); 141 # 2023-04-27: Deactivating examples for now because they cause a non-trivial build failure. 142 # med-module = enableCabalFlag "buildExamples" super.med-module; 143 spreadsheet = enableCabalFlag "buildExamples" ( 144 overrideCabal (drv: { 145 executableHaskellDepends = [ 146 self.optparse-applicative 147 self.shell-utility 148 ]; 149 }) super.spreadsheet 150 ); 151 152 # fix errors caused by hardening flags 153 epanet-haskell = disableHardening [ "format" ] super.epanet-haskell; 154 155 # cabal2nix incorrectly resolves this to pkgs.zip (could be improved over there). 156 streamly-zip = super.streamly-zip.override { zip = pkgs.libzip; }; 157 158 threadscope = enableSeparateBinOutput super.threadscope; 159 160 # Binary may be used separately for e.g. editor integrations 161 cabal-cargs = enableSeparateBinOutput super.cabal-cargs; 162 163 # Use the default version of mysql to build this package (which is actually mariadb). 164 # test phase requires networking 165 mysql = dontCheck super.mysql; 166 167 # CUDA needs help finding the SDK headers and libraries. 168 cuda = overrideCabal (drv: { 169 extraLibraries = (drv.extraLibraries or [ ]) ++ [ pkgs.linuxPackages.nvidia_x11 ]; 170 configureFlags = (drv.configureFlags or [ ]) ++ [ 171 "--extra-lib-dirs=${pkgs.cudatoolkit.lib}/lib" 172 "--extra-include-dirs=${pkgs.cudatoolkit}/include" 173 ]; 174 preConfigure = '' 175 export CUDA_PATH=${pkgs.cudatoolkit} 176 ''; 177 }) super.cuda; 178 179 nvvm = overrideCabal (drv: { 180 preConfigure = '' 181 export CUDA_PATH=${pkgs.cudatoolkit} 182 ''; 183 }) super.nvvm; 184 185 # Doesn't declare LLVM dependency, needs llvm-config 186 llvm-codegen = addBuildTools [ 187 pkgs.llvmPackages.llvm.dev # for native llvm-config 188 ] super.llvm-codegen; 189 190 # hledger* overrides 191 inherit 192 ( 193 let 194 installHledgerExtraFiles = 195 manpagePathPrefix: 196 overrideCabal (drv: { 197 buildTools = drv.buildTools or [ ] ++ [ 198 pkgs.buildPackages.installShellFiles 199 ]; 200 postInstall = '' 201 for i in $(seq 1 9); do 202 installManPage ./${manpagePathPrefix}/*.$i 203 done 204 205 install -v -Dm644 ./${manpagePathPrefix}/*.info* -t "$out/share/info/" 206 207 if [ -e shell-completion/hledger-completion.bash ]; then 208 installShellCompletion --name hledger shell-completion/hledger-completion.bash 209 fi 210 ''; 211 }); 212 213 hledgerWebTestFix = overrideCabal (drv: { 214 preCheck = '' 215 ${drv.preCheck or ""} 216 export HOME="$(mktemp -d)" 217 ''; 218 }); 219 in 220 { 221 hledger = installHledgerExtraFiles "embeddedfiles" super.hledger; 222 hledger-web = installHledgerExtraFiles "" (hledgerWebTestFix super.hledger-web); 223 hledger-ui = installHledgerExtraFiles "" super.hledger-ui; 224 } 225 ) 226 hledger 227 hledger-web 228 hledger-ui 229 ; 230 231 cufft = overrideCabal (drv: { 232 preConfigure = '' 233 export CUDA_PATH=${pkgs.cudatoolkit} 234 ''; 235 }) super.cufft; 236 237 # jni needs help finding libjvm.so because it's in a weird location. 238 jni = overrideCabal (drv: { 239 preConfigure = '' 240 local libdir=( "${pkgs.jdk}/lib/openjdk/jre/lib/"*"/server" ) 241 appendToVar configureFlags "--extra-lib-dir=''${libdir[0]}" 242 ''; 243 }) super.jni; 244 245 # Won't find it's header files without help. 246 sfml-audio = appendConfigureFlag "--extra-include-dirs=${pkgs.openal}/include/AL" super.sfml-audio; 247 248 # avoid compiling twice by providing executable as a separate output (with small closure size) 249 cabal-fmt = enableSeparateBinOutput super.cabal-fmt; 250 hindent = enableSeparateBinOutput super.hindent; 251 releaser = enableSeparateBinOutput super.releaser; 252 eventlog2html = enableSeparateBinOutput super.eventlog2html; 253 ghc-debug-brick = enableSeparateBinOutput super.ghc-debug-brick; 254 nixfmt = enableSeparateBinOutput super.nixfmt; 255 calligraphy = enableSeparateBinOutput super.calligraphy; 256 niv = overrideCabal (drv: { 257 buildTools = (drv.buildTools or [ ]) ++ [ pkgs.buildPackages.makeWrapper ]; 258 postInstall = '' 259 wrapProgram ''${!outputBin}/bin/niv --prefix PATH : ${pkgs.lib.makeBinPath [ pkgs.nix ]} 260 ''; 261 }) (enableSeparateBinOutput (self.generateOptparseApplicativeCompletions [ "niv" ] super.niv)); 262 ghcid = enableSeparateBinOutput super.ghcid; 263 ormolu = self.generateOptparseApplicativeCompletions [ "ormolu" ] ( 264 enableSeparateBinOutput super.ormolu 265 ); 266 hnix = self.generateOptparseApplicativeCompletions [ "hnix" ] super.hnix; 267 268 # Generate shell completion. 269 cabal2nix = self.generateOptparseApplicativeCompletions [ "cabal2nix" ] super.cabal2nix; 270 271 arbtt = overrideCabal (drv: { 272 buildTools = drv.buildTools or [ ] ++ [ 273 pkgs.buildPackages.installShellFiles 274 pkgs.buildPackages.libxslt 275 ]; 276 postBuild = '' 277 xsl=${pkgs.buildPackages.docbook_xsl}/share/xml/docbook-xsl 278 make -C doc man XSLTPROC_MAN_STYLESHEET=$xsl/manpages/profile-docbook.xsl 279 ''; 280 postInstall = '' 281 for f in doc/man/man[1-9]/*; do 282 installManPage $f 283 done 284 ''; 285 # The test suite needs the packages's executables in $PATH to succeed. 286 preCheck = '' 287 for i in $PWD/dist/build/*; do 288 export PATH="$i:$PATH" 289 done 290 ''; 291 # One test uses timezone data 292 testToolDepends = drv.testToolDepends or [ ] ++ [ 293 pkgs.tzdata 294 ]; 295 }) super.arbtt; 296 297 hzk = appendConfigureFlag "--extra-include-dirs=${pkgs.zookeeper_mt}/include/zookeeper" super.hzk; 298 299 # Foreign dependency name clashes with another Haskell package. 300 libarchive-conduit = super.libarchive-conduit.override { archive = pkgs.libarchive; }; 301 302 # Heist's test suite requires system pandoc 303 heist = addTestToolDepend pkgs.pandoc super.heist; 304 305 # Use Nixpkgs' double-conversion library 306 double-conversion = disableCabalFlag "embedded_double_conversion" ( 307 addBuildDepends [ pkgs.double-conversion ] super.double-conversion 308 ); 309 310 # https://github.com/NixOS/cabal2nix/issues/136 and https://github.com/NixOS/cabal2nix/issues/216 311 gio = lib.pipe super.gio [ 312 (disableHardening [ "fortify" ]) 313 (addBuildTool self.buildHaskellPackages.gtk2hs-buildtools) 314 ]; 315 glib = disableHardening [ "fortify" ] ( 316 addPkgconfigDepend pkgs.glib (addBuildTool self.buildHaskellPackages.gtk2hs-buildtools super.glib) 317 ); 318 gtk3 = disableHardening [ "fortify" ] (super.gtk3.override { inherit (pkgs) gtk3; }); 319 gtk = lib.pipe super.gtk ( 320 [ 321 (disableHardening [ "fortify" ]) 322 (addBuildTool self.buildHaskellPackages.gtk2hs-buildtools) 323 ] 324 ++ ( 325 if pkgs.stdenv.hostPlatform.isDarwin then [ (appendConfigureFlag "-fhave-quartz-gtk") ] else [ ] 326 ) 327 ); 328 gtksourceview2 = addPkgconfigDepend pkgs.gtk2 super.gtksourceview2; 329 gtk-traymanager = addPkgconfigDepend pkgs.gtk3 super.gtk-traymanager; 330 331 shelly = overrideCabal (drv: { 332 # /usr/bin/env is unavailable in the sandbox 333 preCheck = drv.preCheck or "" + '' 334 chmod +x ./test/data/*.sh 335 patchShebangs --build test/data 336 ''; 337 }) super.shelly; 338 339 # Add necessary reference to gtk3 package 340 gi-dbusmenugtk3 = addPkgconfigDepend pkgs.gtk3 super.gi-dbusmenugtk3; 341 342 nix-serve-ng = lib.pipe (super.nix-serve-ng.override { nix = pkgs.nixVersions.nix_2_28; }) [ 343 # nix-serve-ng isn't regularly released to Hackage 344 (overrideSrc { 345 src = pkgs.fetchFromGitHub { 346 repo = "nix-serve-ng"; 347 owner = "aristanetworks"; 348 rev = "1d21f73a2d563ffbb924a4244c29b35e898caefe"; 349 hash = "sha256-N6c3NozYqAGwmjf+k5GHOZzlcquDntrJwsZQ7O2sqtQ="; 350 }; 351 version = "1.0.1-unstable-2025-05-28"; 352 }) 353 354 (overrideCabal (old: { 355 # Doesn't declare boost dependency 356 pkg-configDepends = (old.pkg-configDepends or [ ]) ++ [ pkgs.boost.dev ]; 357 358 passthru = old.passthru or { } // { 359 tests.lix = pkgs.lixPackageSets.stable.nix-serve-ng; 360 }; 361 })) 362 ]; 363 364 # These packages try to access the network. 365 amqp = dontCheck super.amqp; 366 amqp-conduit = dontCheck super.amqp-conduit; 367 bitcoin-api = dontCheck super.bitcoin-api; 368 bitcoin-api-extra = dontCheck super.bitcoin-api-extra; 369 bitx-bitcoin = dontCheck super.bitx-bitcoin; # http://hydra.cryp.to/build/926187/log/raw 370 concurrent-dns-cache = dontCheck super.concurrent-dns-cache; 371 digitalocean-kzs = dontCheck super.digitalocean-kzs; # https://github.com/KazumaSATO/digitalocean-kzs/issues/1 372 github-types = dontCheck super.github-types; # http://hydra.cryp.to/build/1114046/nixlog/1/raw 373 hadoop-rpc = dontCheck super.hadoop-rpc; # http://hydra.cryp.to/build/527461/nixlog/2/raw 374 hjsonschema = overrideCabal (drv: { testTargets = [ "local" ]; }) super.hjsonschema; 375 marmalade-upload = dontCheck super.marmalade-upload; # http://hydra.cryp.to/build/501904/nixlog/1/raw 376 mongoDB = dontCheck super.mongoDB; 377 network-transport-zeromq = dontCheck super.network-transport-zeromq; # https://github.com/tweag/network-transport-zeromq/issues/30 378 oidc-client = dontCheck super.oidc-client; # the spec runs openid against google.com 379 persistent-migration = dontCheck super.persistent-migration; # spec requires pg_ctl binary 380 pipes-mongodb = dontCheck super.pipes-mongodb; # http://hydra.cryp.to/build/926195/log/raw 381 pixiv = dontCheck super.pixiv; 382 riak = dontCheck super.riak; # http://hydra.cryp.to/build/498763/log/raw 383 scotty-binding-play = dontCheck super.scotty-binding-play; 384 servant-router = dontCheck super.servant-router; 385 serversession-backend-redis = dontCheck super.serversession-backend-redis; 386 slack-api = dontCheck super.slack-api; # https://github.com/mpickering/slack-api/issues/5 387 stackage = dontCheck super.stackage; # http://hydra.cryp.to/build/501867/nixlog/1/raw 388 textocat-api = dontCheck super.textocat-api; # http://hydra.cryp.to/build/887011/log/raw 389 wreq = dontCheck super.wreq; # http://hydra.cryp.to/build/501895/nixlog/1/raw 390 wreq-sb = dontCheck super.wreq-sb; # http://hydra.cryp.to/build/783948/log/raw 391 download = dontCheck super.download; 392 http-client = dontCheck super.http-client; 393 http-client-openssl = dontCheck super.http-client-openssl; 394 http-client-tls = dontCheck super.http-client-tls; 395 http-conduit = dontCheck super.http-conduit; 396 transient-universe = dontCheck super.transient-universe; 397 telegraph = dontCheck super.telegraph; 398 js-jquery = dontCheck super.js-jquery; 399 hPDB-examples = dontCheck super.hPDB-examples; 400 tcp-streams = dontCheck super.tcp-streams; 401 holy-project = dontCheck super.holy-project; 402 mustache = dontCheck super.mustache; 403 arch-web = dontCheck super.arch-web; 404 405 # Tries accessing the GitHub API 406 github-app-token = dontCheck super.github-app-token; 407 408 # The curl executable is required for withApplication tests. 409 warp = addTestToolDepend pkgs.curl super.warp; 410 411 lz4-frame-conduit = addTestToolDepends [ pkgs.lz4 ] super.lz4-frame-conduit; 412 413 safe-exceptions = overrideCabal (drv: { 414 # Fix strictDeps build error "could not execute: hspec-discover" 415 testToolDepends = drv.testToolDepends or [ ] ++ [ self.hspec-discover ]; 416 }) super.safe-exceptions; 417 418 # Test suite requires running a database server. Testing is done upstream. 419 hasql = dontCheck super.hasql; 420 hasql-dynamic-statements = dontCheck super.hasql-dynamic-statements; 421 hasql-interpolate = dontCheck super.hasql-interpolate; 422 hasql-notifications = dontCheck super.hasql-notifications; 423 hasql-pool = dontCheck super.hasql-pool; 424 hasql-transaction = dontCheck super.hasql-transaction; 425 426 # Avoid compiling twice by providing executable as a separate output (with small closure size), 427 postgres-websockets = lib.pipe super.postgres-websockets [ 428 enableSeparateBinOutput 429 (overrideCabal { passthru.tests = pkgs.nixosTests.postgres-websockets; }) 430 ]; 431 432 # Test suite requires a running postgresql server, 433 # avoid compiling twice by providing executable as a separate output (with small closure size), 434 # generate shell completion 435 postgrest = lib.pipe super.postgrest [ 436 dontCheck 437 enableSeparateBinOutput 438 (self.generateOptparseApplicativeCompletions [ "postgrest" ]) 439 (overrideCabal { passthru.tests = pkgs.nixosTests.postgrest; }) 440 ]; 441 442 # Tries to mess with extended POSIX attributes, but can't in our chroot environment. 443 xattr = dontCheck super.xattr; 444 445 # Needs access to locale data, but looks for it in the wrong place. 446 scholdoc-citeproc = dontCheck super.scholdoc-citeproc; 447 448 # Disable tests because they require a mattermost server 449 mattermost-api = dontCheck super.mattermost-api; 450 451 # Expect to find sendmail(1) in $PATH. 452 mime-mail = appendConfigureFlag "--ghc-option=-DMIME_MAIL_SENDMAIL_PATH=\"sendmail\"" super.mime-mail; 453 454 # Help the test suite find system timezone data. 455 tz = addBuildDepends [ pkgs.tzdata ] super.tz; 456 tzdata = addBuildDepends [ pkgs.tzdata ] super.tzdata; 457 458 # https://hydra.nixos.org/build/128665302/nixlog/3 459 # Disable tests because they require a running dbus session 460 xmonad-dbus = dontCheck super.xmonad-dbus; 461 462 # Test suite requires running a docker container via testcontainers 463 amqp-streamly = dontCheck super.amqp-streamly; 464 465 # wxc supports wxGTX >= 3.0, but our current default version points to 2.8. 466 # http://hydra.cryp.to/build/1331287/log/raw 467 wxc = (addBuildDepend self.split super.wxc).override { wxGTK = pkgs.wxGTK32; }; 468 wxcore = super.wxcore.override { wxGTK = pkgs.wxGTK32; }; 469 470 shellify = enableSeparateBinOutput super.shellify; 471 specup = enableSeparateBinOutput super.specup; 472 aws-spend-summary = self.generateOptparseApplicativeCompletions [ "aws-spend-summary" ] ( 473 enableSeparateBinOutput super.aws-spend-summary 474 ); 475 476 # Test suite wants to connect to $DISPLAY. 477 bindings-GLFW = dontCheck super.bindings-GLFW; 478 gi-gtk-declarative = dontCheck super.gi-gtk-declarative; 479 gi-gtk-declarative-app-simple = dontCheck super.gi-gtk-declarative-app-simple; 480 hsqml = dontCheck ( 481 addExtraLibraries [ pkgs.libGLU pkgs.libGL ] (super.hsqml.override { qt5 = pkgs.qt5Full; }) 482 ); 483 monomer = dontCheck super.monomer; 484 485 # Wants to check against a real DB, Needs freetds 486 odbc = dontCheck (addExtraLibraries [ pkgs.freetds ] super.odbc); 487 488 # Tests attempt to use NPM to install from the network into 489 # /homeless-shelter. Disabled. 490 purescript = dontCheck super.purescript; 491 492 # Hardcoded include path 493 poppler = overrideCabal (drv: { 494 postPatch = '' 495 sed -i -e 's,glib/poppler.h,poppler.h,' poppler.cabal 496 sed -i -e 's,glib/poppler.h,poppler.h,' Graphics/UI/Gtk/Poppler/Structs.hsc 497 ''; 498 }) super.poppler; 499 500 # Uses OpenGL in testing 501 caramia = dontCheck super.caramia; 502 503 # llvm-ffi needs a specific version of LLVM which we hard code here. Since we 504 # can't use pkg-config (LLVM has no official .pc files), we need to pass the 505 # `dev` and `lib` output in, or Cabal will have trouble finding the library. 506 # Since it looks a bit neater having it in a list, we circumvent the singular 507 # LLVM input that llvm-ffi declares. 508 llvm-ffi = 509 let 510 currentDefaultVersion = lib.versions.major pkgs.llvmPackages.llvm.version; 511 latestSupportedVersion = lib.versions.major super.llvm-ffi.version; 512 in 513 lib.pipe super.llvm-ffi ( 514 [ 515 (addBuildDepends [ 516 pkgs.llvmPackages.llvm.lib 517 pkgs.llvmPackages.llvm.dev 518 ]) 519 ] 520 # There is no matching flag for the latest supported LLVM version. 521 ++ lib.optional (currentDefaultVersion != latestSupportedVersion) ( 522 enableCabalFlag "LLVM${currentDefaultVersion}00" 523 ) 524 ); 525 526 # Forces the LLVM backend; upstream signalled intent to remove this 527 # in 2017: <https://github.com/SeanRBurton/spaceprobe/issues/1>. 528 spaceprobe = overrideCabal (drv: { 529 postPatch = '' 530 substituteInPlace spaceprobe.cabal \ 531 --replace-fail '-fllvm ' "" 532 ''; 533 }) super.spaceprobe; 534 535 # Forces the LLVM backend. 536 GlomeVec = overrideCabal (drv: { 537 postPatch = '' 538 substituteInPlace GlomeVec.cabal \ 539 --replace-fail '-fllvm ' "" 540 ''; 541 }) super.GlomeVec; 542 543 # Tries to run GUI in tests 544 leksah = dontCheck ( 545 overrideCabal (drv: { 546 executableSystemDepends = 547 (drv.executableSystemDepends or [ ]) 548 ++ (with pkgs; [ 549 adwaita-icon-theme # Fix error: Icon 'window-close' not present in theme ... 550 wrapGAppsHook3 # Fix error: GLib-GIO-ERROR **: No GSettings schemas are installed on the system 551 gtk3 # Fix error: GLib-GIO-ERROR **: Settings schema 'org.gtk.Settings.FileChooser' is not installed 552 ]); 553 postPatch = (drv.postPatch or "") + '' 554 for f in src/IDE/Leksah.hs src/IDE/Utils/ServerConnection.hs 555 do 556 substituteInPlace "$f" --replace "\"leksah-server\"" "\"${self.leksah-server}/bin/leksah-server\"" 557 done 558 ''; 559 }) super.leksah 560 ); 561 562 # dyre's tests appear to be trying to directly call GHC. 563 dyre = dontCheck super.dyre; 564 565 # https://github.com/edwinb/EpiVM/issues/13 566 # https://github.com/edwinb/EpiVM/issues/14 567 epic = addExtraLibraries [ pkgs.boehmgc pkgs.gmp ] ( 568 addBuildTool self.buildHaskellPackages.happy super.epic 569 ); 570 571 # https://github.com/ekmett/wl-pprint-terminfo/issues/7 572 wl-pprint-terminfo = addExtraLibrary pkgs.ncurses super.wl-pprint-terminfo; 573 574 # https://github.com/bos/pcap/issues/5 575 pcap = addExtraLibrary pkgs.libpcap super.pcap; 576 577 # https://github.com/NixOS/nixpkgs/issues/53336 578 greenclip = addExtraLibrary pkgs.xorg.libXdmcp super.greenclip; 579 580 # The cabal files for these libraries do not list the required system dependencies. 581 libjwt-typed = addExtraLibrary pkgs.libjwt super.libjwt-typed; 582 miniball = addExtraLibrary pkgs.miniball super.miniball; 583 SDL-image = addExtraLibrary pkgs.SDL super.SDL-image; 584 SDL-ttf = addExtraLibrary pkgs.SDL super.SDL-ttf; 585 SDL-mixer = addExtraLibrary pkgs.SDL super.SDL-mixer; 586 SDL-gfx = addExtraLibrary pkgs.SDL super.SDL-gfx; 587 SDL-mpeg = appendConfigureFlags [ 588 "--extra-lib-dirs=${pkgs.smpeg}/lib" 589 "--extra-include-dirs=${pkgs.smpeg.dev}/include/smpeg" 590 ] super.SDL-mpeg; 591 592 # https://github.com/ivanperez-keera/hcwiid/pull/4 593 hcwiid = overrideCabal (drv: { 594 configureFlags = (drv.configureFlags or [ ]) ++ [ 595 "--extra-lib-dirs=${pkgs.bluez.out}/lib" 596 "--extra-lib-dirs=${pkgs.cwiid}/lib" 597 "--extra-include-dirs=${pkgs.cwiid}/include" 598 "--extra-include-dirs=${pkgs.bluez.dev}/include" 599 ]; 600 prePatch = ''sed -i -e "/Extra-Lib-Dirs/d" -e "/Include-Dirs/d" "hcwiid.cabal"''; 601 }) super.hcwiid; 602 603 # cabal2nix doesn't pick up some of the dependencies. 604 ginsu = 605 let 606 g = addBuildDepend pkgs.perl super.ginsu; 607 g' = overrideCabal (drv: { 608 executableSystemDepends = (drv.executableSystemDepends or [ ]) ++ [ 609 pkgs.ncurses 610 ]; 611 }) g; 612 in 613 g'; 614 615 # Tests require `docker` command in PATH 616 # Tests require running docker service :on localhost 617 docker = dontCheck super.docker; 618 619 # https://github.com/deech/fltkhs/issues/16 620 fltkhs = overrideCabal (drv: { 621 libraryToolDepends = (drv.libraryToolDepends or [ ]) ++ [ pkgs.buildPackages.autoconf ]; 622 librarySystemDepends = (drv.librarySystemDepends or [ ]) ++ [ 623 pkgs.fltk13 624 pkgs.libGL 625 pkgs.libjpeg 626 ]; 627 }) super.fltkhs; 628 629 # Select dependency discovery method and provide said dependency 630 jpeg-turbo = enableCabalFlag "pkgconfig" ( 631 addPkgconfigDepends [ pkgs.libjpeg_turbo ] super.jpeg-turbo 632 ); 633 634 # https://github.com/skogsbaer/hscurses/pull/26 635 hscurses = addExtraLibrary pkgs.ncurses super.hscurses; 636 637 # Looks like Avahi provides the missing library 638 dnssd = super.dnssd.override { dns_sd = pkgs.avahi.override { withLibdnssdCompat = true; }; }; 639 640 # Tests execute goldplate 641 goldplate = overrideCabal (drv: { 642 preCheck = drv.preCheck or "" + '' 643 export PATH="$PWD/dist/build/goldplate:$PATH" 644 ''; 645 }) super.goldplate; 646 647 # At least on 1.3.4 version on 32-bit architectures tasty requires 648 # unbounded-delays via .cabal file conditions. 649 tasty = overrideCabal (drv: { 650 libraryHaskellDepends = 651 (drv.libraryHaskellDepends or [ ]) 652 ++ lib.optionals (!(pkgs.stdenv.hostPlatform.isAarch64 || pkgs.stdenv.hostPlatform.isx86_64)) [ 653 self.unbounded-delays 654 ]; 655 }) super.tasty; 656 657 tasty-discover = overrideCabal (drv: { 658 # Depends on itself for testing 659 preBuild = '' 660 export PATH="$PWD/dist/build/tasty-discover:$PATH" 661 '' 662 + (drv.preBuild or ""); 663 }) super.tasty-discover; 664 665 # GLUT uses `dlopen` to link to freeglut, so we need to set the RUNPATH correctly for 666 # it to find `libglut.so` from the nix store. We do this by patching GLUT.cabal to pkg-config 667 # depend on freeglut, which provides GHC to necessary information to generate a correct RPATH. 668 # 669 # Note: Simply patching the dynamic library (.so) of the GLUT build will *not* work, since the 670 # RPATH also needs to be propagated when using static linking. GHC automatically handles this for 671 # us when we patch the cabal file (Link options will be recorded in the ghc package registry). 672 # 673 # Additional note: nixpkgs' freeglut and macOS's OpenGL implementation do not cooperate, 674 # so disable this on Darwin only 675 ${if pkgs.stdenv.hostPlatform.isDarwin then null else "GLUT"} = overrideCabal (drv: { 676 pkg-configDepends = drv.pkg-configDepends or [ ] ++ [ 677 pkgs.freeglut 678 ]; 679 patches = drv.patches or [ ] ++ [ 680 ./patches/GLUT.patch 681 ]; 682 prePatch = drv.prePatch or "" + '' 683 ${lib.getBin pkgs.buildPackages.dos2unix}/bin/dos2unix *.cabal 684 ''; 685 }) super.GLUT; 686 687 libsystemd-journal = addExtraLibrary pkgs.systemd super.libsystemd-journal; 688 689 # does not specify tests in cabal file, instead has custom runTest cabal hook, 690 # so cabal2nix will not detect test dependencies. 691 either-unwrap = overrideCabal (drv: { 692 testHaskellDepends = (drv.testHaskellDepends or [ ]) ++ [ 693 self.test-framework 694 self.test-framework-hunit 695 ]; 696 }) super.either-unwrap; 697 698 hs-GeoIP = super.hs-GeoIP.override { GeoIP = pkgs.geoipWithDatabase; }; 699 700 discount = super.discount.override { markdown = pkgs.discount; }; 701 702 # tests require working stack installation with all-cabal-hashes cloned in $HOME 703 stackage-curator = dontCheck super.stackage-curator; 704 705 stack = self.generateOptparseApplicativeCompletions [ "stack" ] super.stack; 706 707 # hardcodes /usr/bin/tr: https://github.com/snapframework/io-streams/pull/59 708 io-streams = enableCabalFlag "NoInteractiveTests" super.io-streams; 709 710 # requires autotools to build 711 secp256k1 = addBuildTools [ 712 pkgs.buildPackages.autoconf 713 pkgs.buildPackages.automake 714 pkgs.buildPackages.libtool 715 ] super.secp256k1; 716 717 # requires libsecp256k1 in pkg-config-depends 718 secp256k1-haskell = addPkgconfigDepend pkgs.secp256k1 super.secp256k1-haskell; 719 720 # tests require git and zsh 721 hapistrano = addBuildTools [ pkgs.buildPackages.git pkgs.buildPackages.zsh ] super.hapistrano; 722 723 # This propagates this to everything depending on haskell-gi-base 724 haskell-gi-base = addBuildDepend pkgs.gobject-introspection super.haskell-gi-base; 725 726 # requires valid, writeable $HOME 727 hatex-guide = overrideCabal (drv: { 728 preConfigure = '' 729 ${drv.preConfigure or ""} 730 export HOME=$PWD 731 ''; 732 }) super.hatex-guide; 733 734 # https://github.com/plow-technologies/servant-streaming/issues/12 735 servant-streaming-server = dontCheck super.servant-streaming-server; 736 737 # https://github.com/haskell-servant/servant/pull/1238 738 servant-client-core = 739 if (pkgs.lib.getVersion super.servant-client-core) == "0.16" then 740 appendPatch ./patches/servant-client-core-redact-auth-header.patch super.servant-client-core 741 else 742 super.servant-client-core; 743 744 # tests run executable, relying on PATH 745 # without this, tests fail with "Couldn't launch intero process" 746 intero = overrideCabal (drv: { 747 preCheck = '' 748 export PATH="$PWD/dist/build/intero:$PATH" 749 ''; 750 }) super.intero; 751 752 # Break infinite recursion cycle with criterion and network-uri. 753 js-flot = dontCheck super.js-flot; 754 755 # Break infinite recursion cycle between QuickCheck and splitmix. 756 splitmix = dontCheck super.splitmix; 757 splitmix_0_1_1 = dontCheck super.splitmix_0_1_1; 758 759 # Break infinite recursion cycle with OneTuple and quickcheck-instances. 760 foldable1-classes-compat = dontCheck super.foldable1-classes-compat; 761 762 # Break infinite recursion cycle between tasty and clock. 763 clock = dontCheck super.clock; 764 765 # Break infinite recursion cycle between devtools and mprelude. 766 devtools = super.devtools.override { mprelude = dontCheck super.mprelude; }; 767 768 # Break dependency cycle between tasty-hedgehog and tasty-expected-failure 769 tasty-hedgehog = dontCheck super.tasty-hedgehog; 770 771 # Break dependency cycle between hedgehog, tasty-hedgehog and lifted-async 772 lifted-async = dontCheck super.lifted-async; 773 774 # loc and loc-test depend on each other for testing. Break that infinite cycle: 775 loc-test = super.loc-test.override { loc = dontCheck self.loc; }; 776 777 # The test suites try to run the "fixpoint" and "liquid" executables built just 778 # before and fail because the library search paths aren't configured properly. 779 # Also needs https://github.com/ucsd-progsys/liquidhaskell/issues/1038 resolved. 780 liquid-fixpoint = disableSharedExecutables super.liquid-fixpoint; 781 liquidhaskell = dontCheck (disableSharedExecutables super.liquidhaskell); 782 783 # Break cyclic reference that results in an infinite recursion. 784 partial-semigroup = dontCheck super.partial-semigroup; 785 colour = dontCheck super.colour; 786 spatial-rotations = dontCheck super.spatial-rotations; 787 788 LDAP = dontCheck ( 789 overrideCabal (drv: { 790 librarySystemDepends = drv.librarySystemDepends or [ ] ++ [ pkgs.cyrus_sasl.dev ]; 791 }) super.LDAP 792 ); 793 794 # Not running the "example" test because it requires a binary from lsps test 795 # suite which is not part of the output of lsp. 796 lsp-test = overrideCabal (old: { 797 testTargets = [ 798 "tests" 799 "func-test" 800 ]; 801 }) super.lsp-test; 802 803 # the test suite attempts to run the binaries built in this package 804 # through $PATH but they aren't in $PATH 805 dhall-lsp-server = dontCheck super.dhall-lsp-server; 806 807 # Test suite requires z3 to be in PATH 808 copilot-libraries = overrideCabal (drv: { 809 testToolDepends = drv.testToolDepends or [ ] ++ [ 810 pkgs.z3 811 ]; 812 }) super.copilot-libraries; 813 # tests need to execute the built executable 814 ogma-cli = overrideCabal (drv: { 815 preCheck = '' 816 export PATH=dist/build/ogma:$PATH 817 '' 818 + (drv.preCheck or ""); 819 }) super.ogma-cli; 820 821 # Expects z3 to be on path so we replace it with a hard 822 # 823 # The tests expect additional solvers on the path, replace the 824 # available ones also with hard coded paths, and remove the missing 825 # ones from the test. 826 # TODO(@sternenseemann): package cvc5 and re-enable tests 827 sbv = overrideCabal (drv: { 828 postPatch = '' 829 sed -i -e 's|"abc"|"${pkgs.abc-verifier}/bin/abc"|' Data/SBV/Provers/ABC.hs 830 sed -i -e 's|"bitwuzla"|"${pkgs.bitwuzla}/bin/bitwuzla"|' Data/SBV/Provers/Bitwuzla.hs 831 sed -i -e 's|"boolector"|"${pkgs.boolector}/bin/boolector"|' Data/SBV/Provers/Boolector.hs 832 sed -i -e 's|"cvc4"|"${pkgs.cvc4}/bin/cvc4"|' Data/SBV/Provers/CVC4.hs 833 sed -i -e 's|"cvc5"|"${pkgs.cvc5}/bin/cvc5"|' Data/SBV/Provers/CVC5.hs 834 sed -i -e 's|"yices-smt2"|"${pkgs.yices}/bin/yices-smt2"|' Data/SBV/Provers/Yices.hs 835 sed -i -e 's|"z3"|"${pkgs.z3}/bin/z3"|' Data/SBV/Provers/Z3.hs 836 837 # Solvers we don't provide are removed from tests 838 sed -i -e 's|, mathSAT||' SBVTestSuite/SBVConnectionTest.hs 839 sed -i -e 's|, dReal||' SBVTestSuite/SBVConnectionTest.hs 840 ''; 841 }) super.sbv; 842 843 # The test-suite requires a running PostgreSQL server. 844 Frames-beam = dontCheck super.Frames-beam; 845 846 # Test suite requires yices to be in PATH 847 crucible-symio = overrideCabal (drv: { 848 testToolDepends = drv.testToolDepends or [ ] ++ [ 849 pkgs.yices 850 ]; 851 }) super.crucible-symio; 852 853 # Test suite requires z3 to be in PATH 854 crucible-llvm = addTestToolDepends [ 855 pkgs.z3 856 ] super.crucible-llvm; 857 858 # yaml doesn't build its executables (json2yaml, yaml2json) by default: 859 # https://github.com/snoyberg/yaml/issues/194 860 yaml = lib.pipe super.yaml [ 861 (disableCabalFlag "no-exe") 862 enableSeparateBinOutput 863 (addBuildDepend self.optparse-applicative) 864 ]; 865 866 # Compile manpages (which are in RST and are compiled with Sphinx). 867 futhark = 868 overrideCabal 869 (_drv: { 870 postBuild = (_drv.postBuild or "") + '' 871 make -C docs man 872 ''; 873 874 postInstall = (_drv.postInstall or "") + '' 875 mkdir -p $out/share/man/man1 876 mv docs/_build/man/*.1 $out/share/man/man1/ 877 ''; 878 }) 879 ( 880 addBuildTools (with pkgs.buildPackages; [ 881 makeWrapper 882 python3Packages.sphinx 883 ]) super.futhark 884 ); 885 886 git-annex = 887 let 888 # Executables git-annex needs at runtime. git-annex detects these at configure 889 # time and expects to be able to execute them. This means that cross-compiling 890 # git-annex is not possible and strictDeps must be false (runtimeExecDeps go 891 # into executableSystemDepends/buildInputs). 892 runtimeExecDeps = [ 893 pkgs.bup 894 pkgs.curl 895 pkgs.git 896 pkgs.gnupg 897 pkgs.lsof 898 pkgs.openssh 899 pkgs.perl 900 pkgs.rsync 901 pkgs.wget 902 pkgs.which 903 ]; 904 in 905 overrideCabal 906 (drv: { 907 executableSystemDepends = runtimeExecDeps; 908 enableSharedExecutables = false; 909 910 # Unnecessary for Setup.hs, but we reuse the setup package db 911 # for the installation utilities. 912 setupHaskellDepends = drv.setupHaskellDepends or [ ] ++ [ 913 self.buildHaskellPackages.unix-compat 914 self.buildHaskellPackages.IfElse 915 self.buildHaskellPackages.QuickCheck 916 self.buildHaskellPackages.data-default 917 ]; 918 919 preConfigure = drv.preConfigure or "" + '' 920 export HOME=$TEMPDIR 921 patchShebangs . 922 ''; 923 924 # git-annex ships its test suite as part of the final executable instead of 925 # using a Cabal test suite. 926 checkPhase = '' 927 runHook preCheck 928 929 # Setup PATH for the actual tests 930 ln -sf dist/build/git-annex/git-annex git-annex 931 ln -sf git-annex git-annex-shell 932 ln -sf git-annex git-remote-annex 933 ln -sf git-annex git-remote-tor-annex 934 PATH+=":$PWD" 935 936 echo checkFlags: $checkFlags ''${checkFlagsArray:+"''${checkFlagsArray[@]}"} 937 938 # Doesn't use Cabal's test mechanism 939 git-annex test $checkFlags ''${checkFlagsArray:+"''${checkFlagsArray[@]}"} 940 941 runHook postCheck 942 ''; 943 944 # Use default installPhase of pkgs/stdenv/generic/setup.sh. We need to set 945 # the environment variables it uses via the preInstall hook since the Haskell 946 # generic builder doesn't accept them as arguments. 947 preInstall = drv.preInstall or "" + '' 948 installTargets="install" 949 installFlagsArray+=( 950 "PREFIX=" 951 "DESTDIR=$out" 952 # Prevent Makefile from calling cabal/Setup again 953 "BUILDER=:" 954 # Make Haskell build dependencies available 955 "GHC=${self.buildHaskellPackages.ghc.targetPrefix}ghc -global-package-db -package-db $setupPackageConfDir" 956 ) 957 ''; 958 installPhase = null; 959 960 # Ensure git-annex uses the exact same coreutils it saw at build-time. 961 # This is especially important on Darwin but also in Linux environments 962 # where non-GNU coreutils are used by default. 963 postFixup = '' 964 wrapProgram $out/bin/git-annex \ 965 --prefix PATH : "${ 966 pkgs.lib.makeBinPath ( 967 with pkgs; 968 [ 969 coreutils 970 lsof 971 ] 972 ) 973 }" 974 '' 975 + (drv.postFixup or ""); 976 buildTools = [ 977 pkgs.buildPackages.makeWrapper 978 ] 979 ++ (drv.buildTools or [ ]); 980 981 # Git annex provides a restricted login shell. Setting 982 # passthru.shellPath here allows a user's login shell to be set to 983 # `git-annex-shell` by making `shell = haskellPackages.git-annex`. 984 # https://git-annex.branchable.com/git-annex-shell/ 985 passthru.shellPath = "/bin/git-annex-shell"; 986 }) 987 ( 988 super.git-annex.override { 989 dbus = if pkgs.stdenv.hostPlatform.isLinux then self.dbus else null; 990 fdo-notify = if pkgs.stdenv.hostPlatform.isLinux then self.fdo-notify else null; 991 hinotify = if pkgs.stdenv.hostPlatform.isLinux then self.hinotify else self.fsnotify; 992 } 993 ); 994 995 # The test suite has undeclared dependencies on git. 996 githash = dontCheck super.githash; 997 998 # Avoid infitite recursion with tonatona. 999 tonaparser = dontCheck super.tonaparser; 1000 1001 # Needs internet to run tests 1002 HTTP = dontCheck super.HTTP; 1003 1004 # Break infinite recursions. 1005 Dust-crypto = dontCheck super.Dust-crypto; 1006 nanospec = dontCheck super.nanospec; 1007 options = dontCheck super.options; 1008 snap-server = dontCheck super.snap-server; 1009 1010 # Tests require internet 1011 http-download = dontCheck super.http-download; 1012 http-download_0_2_1_0 = doDistribute (dontCheck super.http-download_0_2_1_0); 1013 pantry = dontCheck super.pantry; 1014 pantry_0_9_3_1 = dontCheck super.pantry_0_9_3_1; 1015 pantry_0_10_0 = dontCheck super.pantry_0_10_0; 1016 1017 # gtk2hs-buildtools is listed in setupHaskellDepends, but we 1018 # need it during the build itself, too. 1019 cairo = addBuildTool self.buildHaskellPackages.gtk2hs-buildtools super.cairo; 1020 pango = disableHardening [ "fortify" ] ( 1021 addBuildTool self.buildHaskellPackages.gtk2hs-buildtools super.pango 1022 ); 1023 1024 spago = 1025 let 1026 docsSearchApp_0_0_10 = pkgs.fetchurl { 1027 url = "https://github.com/purescript/purescript-docs-search/releases/download/v0.0.10/docs-search-app.js"; 1028 sha256 = "0m5ah29x290r0zk19hx2wix2djy7bs4plh9kvjz6bs9r45x25pa5"; 1029 }; 1030 1031 docsSearchApp_0_0_11 = pkgs.fetchurl { 1032 url = "https://github.com/purescript/purescript-docs-search/releases/download/v0.0.11/docs-search-app.js"; 1033 sha256 = "17qngsdxfg96cka1cgrl3zdrpal8ll6vyhhnazqm4hwj16ywjm02"; 1034 }; 1035 1036 purescriptDocsSearch_0_0_10 = pkgs.fetchurl { 1037 url = "https://github.com/purescript/purescript-docs-search/releases/download/v0.0.10/purescript-docs-search"; 1038 sha256 = "0wc1zyhli4m2yykc6i0crm048gyizxh7b81n8xc4yb7ibjqwhyj3"; 1039 }; 1040 1041 purescriptDocsSearch_0_0_11 = pkgs.fetchurl { 1042 url = "https://github.com/purescript/purescript-docs-search/releases/download/v0.0.11/purescript-docs-search"; 1043 sha256 = "1hjdprm990vyxz86fgq14ajn0lkams7i00h8k2i2g1a0hjdwppq6"; 1044 }; 1045 in 1046 lib.pipe 1047 (super.spago.override { 1048 # base <4.19, text <2.1 1049 versions = doJailbreak self.versions_5_0_5; 1050 fsnotify = self.fsnotify_0_3_0_1; 1051 }) 1052 [ 1053 (overrideCabal (drv: { 1054 postUnpack = (drv.postUnpack or "") + '' 1055 # Spago includes the following two files directly into the binary 1056 # with Template Haskell. They are fetched at build-time from the 1057 # `purescript-docs-search` repo above. If they cannot be fetched at 1058 # build-time, they are pulled in from the `templates/` directory in 1059 # the spago source. 1060 # 1061 # However, they are not actually available in the spago source, so they 1062 # need to fetched with nix and put in the correct place. 1063 # https://github.com/spacchetti/spago/issues/510 1064 cp ${docsSearchApp_0_0_10} "$sourceRoot/templates/docs-search-app-0.0.10.js" 1065 cp ${docsSearchApp_0_0_11} "$sourceRoot/templates/docs-search-app-0.0.11.js" 1066 cp ${purescriptDocsSearch_0_0_10} "$sourceRoot/templates/purescript-docs-search-0.0.10" 1067 cp ${purescriptDocsSearch_0_0_11} "$sourceRoot/templates/purescript-docs-search-0.0.11" 1068 1069 # For some weird reason, on Darwin, the open(2) call to embed these files 1070 # requires write permissions. The easiest resolution is just to permit that 1071 # (doesn't cause any harm on other systems). 1072 chmod u+w \ 1073 "$sourceRoot/templates/docs-search-app-0.0.10.js" \ 1074 "$sourceRoot/templates/purescript-docs-search-0.0.10" \ 1075 "$sourceRoot/templates/docs-search-app-0.0.11.js" \ 1076 "$sourceRoot/templates/purescript-docs-search-0.0.11" 1077 ''; 1078 })) 1079 1080 # Tests require network access. 1081 dontCheck 1082 1083 # Overly strict upper bound on text 1084 doJailbreak 1085 1086 # Generate shell completion for spago 1087 (self.generateOptparseApplicativeCompletions [ "spago" ]) 1088 ]; 1089 1090 # checks SQL statements at compile time, and so requires a running PostgreSQL 1091 # database to run it's test suite 1092 postgresql-typed = dontCheck super.postgresql-typed; 1093 1094 # mplayer-spot uses mplayer at runtime. 1095 mplayer-spot = 1096 let 1097 path = pkgs.lib.makeBinPath [ pkgs.mplayer ]; 1098 in 1099 overrideCabal (oldAttrs: { 1100 postInstall = '' 1101 wrapProgram $out/bin/mplayer-spot --prefix PATH : "${path}" 1102 ''; 1103 }) (addBuildTool pkgs.buildPackages.makeWrapper super.mplayer-spot); 1104 1105 # break infinite recursion with base-orphans 1106 primitive = dontCheck super.primitive; 1107 primitive_0_7_1_0 = dontCheck super.primitive_0_7_1_0; 1108 1109 cut-the-crap = 1110 let 1111 path = pkgs.lib.makeBinPath [ 1112 pkgs.ffmpeg 1113 pkgs.youtube-dl 1114 ]; 1115 in 1116 overrideCabal (_drv: { 1117 postInstall = '' 1118 wrapProgram $out/bin/cut-the-crap \ 1119 --prefix PATH : "${path}" 1120 ''; 1121 }) (addBuildTool pkgs.buildPackages.makeWrapper super.cut-the-crap); 1122 1123 # Compiling the readme throws errors and has no purpose in nixpkgs 1124 aeson-gadt-th = disableCabalFlag "build-readme" super.aeson-gadt-th; 1125 1126 # Fix compilation of Setup.hs by removing the module declaration. 1127 # See: https://github.com/tippenein/guid/issues/1 1128 guid = overrideCabal (drv: { 1129 prePatch = "sed -i '1d' Setup.hs"; # 1st line is module declaration, remove it 1130 doCheck = false; 1131 }) super.guid; 1132 1133 # Tests disabled as recommended at https://github.com/luke-clifton/shh/issues/39 1134 shh = dontCheck super.shh; 1135 1136 # The test suites fail because there's no PostgreSQL database running in our 1137 # build sandbox. 1138 hasql-queue = dontCheck super.hasql-queue; 1139 postgresql-libpq-notify = dontCheck super.postgresql-libpq-notify; 1140 postgresql-pure = dontCheck super.postgresql-pure; 1141 1142 # Needs PostgreSQL db during tests 1143 relocant = overrideCabal (drv: { 1144 preCheck = '' 1145 export postgresqlTestUserOptions="LOGIN SUPERUSER" 1146 export PGDATABASE=relocant 1147 ''; 1148 testToolDepends = drv.testToolDepends or [ ] ++ [ 1149 pkgs.postgresql 1150 pkgs.postgresqlTestHook 1151 ]; 1152 }) super.relocant; 1153 1154 # https://gitlab.iscpif.fr/gargantext/haskell-pgmq/blob/9a869df2842eccc86a0f31a69fb8dc5e5ca218a8/README.md#running-test-cases 1155 haskell-pgmq = overrideCabal (drv: { 1156 env = drv.env or { } // { 1157 postgresqlEnableTCP = toString true; 1158 }; 1159 testToolDepends = drv.testToolDepends or [ ] ++ [ 1160 # otherwise .dev gets selected?! 1161 (lib.getBin (pkgs.postgresql.withPackages (ps: [ ps.pgmq ]))) 1162 pkgs.postgresqlTestHook 1163 ]; 1164 }) super.haskell-pgmq; 1165 1166 # https://gitlab.iscpif.fr/gargantext/haskell-bee/blob/19c8775f0d960c669235bf91131053cb6f69a1c1/README.md#redis 1167 haskell-bee-redis = overrideCabal (drv: { 1168 testToolDepends = drv.testToolDepends or [ ] ++ [ 1169 pkgs.redisTestHook 1170 ]; 1171 }) super.haskell-bee-redis; 1172 1173 retrie = addTestToolDepends [ pkgs.git pkgs.mercurial ] super.retrie; 1174 retrie_1_2_0_0 = addTestToolDepends [ pkgs.git pkgs.mercurial ] super.retrie_1_2_0_0; 1175 retrie_1_2_1_1 = addTestToolDepends [ pkgs.git pkgs.mercurial ] super.retrie_1_2_1_1; 1176 1177 # Just an executable 1178 ret = enableSeparateBinOutput super.ret; 1179 1180 # there are three very heavy test suites that need external repos, one requires network access 1181 hevm = dontCheck super.hevm; 1182 1183 # hadolint enables static linking by default in the cabal file, so we have to explicitly disable it. 1184 # https://github.com/hadolint/hadolint/commit/e1305042c62d52c2af4d77cdce5d62f6a0a3ce7b 1185 hadolint = disableCabalFlag "static" super.hadolint; 1186 1187 # Test suite tries to execute the build product "doctest-driver-gen", but it's not in $PATH. 1188 doctest-driver-gen = dontCheck super.doctest-driver-gen; 1189 1190 # Tests access internet 1191 prune-juice = dontCheck super.prune-juice; 1192 1193 citeproc = lib.pipe super.citeproc [ 1194 enableSeparateBinOutput 1195 # Enable executable being built and add missing dependencies 1196 (enableCabalFlag "executable") 1197 (addBuildDepends [ self.aeson-pretty ]) 1198 # TODO(@sternenseemann): we may want to enable that for improved performance 1199 # Is correctness good enough since 0.5? 1200 (disableCabalFlag "icu") 1201 ]; 1202 1203 # based on https://github.com/gibiansky/IHaskell/blob/aafeabef786154d81ab7d9d1882bbcd06fc8c6c4/release.nix 1204 ihaskell = overrideCabal (drv: { 1205 # ihaskell's cabal file forces building a shared executable, which we need 1206 # to reflect here or RPATH will contain a reference to /build/. 1207 enableSharedExecutables = true; 1208 preCheck = '' 1209 export HOME=$TMPDIR/home 1210 export PATH=$PWD/dist/build/ihaskell:$PATH 1211 export NIX_GHC_PACKAGE_PATH_FOR_TEST=$PWD/dist/package.conf.inplace/:$packageConfDir: 1212 ''; 1213 }) super.ihaskell; 1214 1215 # tests need to execute the built executable 1216 stutter = overrideCabal (drv: { 1217 preCheck = '' 1218 export PATH=dist/build/stutter:$PATH 1219 '' 1220 + (drv.preCheck or ""); 1221 }) super.stutter; 1222 1223 # Install man page and generate shell completions 1224 pinboard-notes-backup = overrideCabal (drv: { 1225 postInstall = '' 1226 install -D man/pnbackup.1 $out/share/man/man1/pnbackup.1 1227 '' 1228 + (drv.postInstall or ""); 1229 }) (self.generateOptparseApplicativeCompletions [ "pnbackup" ] super.pinboard-notes-backup); 1230 1231 # Pass the correct libarchive into the package. 1232 streamly-archive = super.streamly-archive.override { archive = pkgs.libarchive; }; 1233 1234 hlint = overrideCabal (drv: { 1235 postInstall = '' 1236 install -Dm644 data/hlint.1 -t "$out/share/man/man1" 1237 '' 1238 + drv.postInstall or ""; 1239 }) super.hlint; 1240 1241 taglib = overrideCabal (drv: { 1242 librarySystemDepends = [ 1243 pkgs.zlib 1244 ] 1245 ++ (drv.librarySystemDepends or [ ]); 1246 }) super.taglib; 1247 1248 # random 1.2.0 has tests that indirectly depend on 1249 # itself causing an infinite recursion at evaluation 1250 # time 1251 random = dontCheck super.random; 1252 1253 # https://github.com/Gabriella439/nix-diff/pull/74 1254 nix-diff = overrideCabal (drv: { 1255 postPatch = '' 1256 substituteInPlace src/Nix/Diff/Types.hs \ 1257 --replace "{-# OPTIONS_GHC -Wno-orphans #-}" "{-# OPTIONS_GHC -Wno-orphans -fconstraint-solver-iterations=0 #-}" 1258 ''; 1259 }) (dontCheck super.nix-diff); 1260 1261 # mockery's tests depend on hspec-discover which dependso on mockery for its tests 1262 mockery = dontCheck super.mockery; 1263 # same for logging-facade 1264 logging-facade = dontCheck super.logging-facade; 1265 1266 # Since this package is primarily used by nixpkgs maintainers and is probably 1267 # not used to link against by anyone, we can make it’s closure smaller and 1268 # add its runtime dependencies in `haskellPackages` (as opposed to cabal2nix). 1269 cabal2nix-unstable = overrideCabal (drv: { 1270 buildTools = (drv.buildTools or [ ]) ++ [ 1271 pkgs.buildPackages.makeWrapper 1272 ]; 1273 postInstall = '' 1274 ${drv.postInstall or ""} 1275 1276 wrapProgram $out/bin/cabal2nix \ 1277 --prefix PATH ":" "${ 1278 pkgs.lib.makeBinPath [ 1279 pkgs.nix 1280 pkgs.nix-prefetch-scripts 1281 ] 1282 }" 1283 ''; 1284 1285 passthru = { 1286 updateScript = ../../../maintainers/scripts/haskell/update-cabal2nix-unstable.sh; 1287 1288 # This is used by regenerate-hackage-packages.nix to supply the configuration 1289 # values we can easily generate automatically without checking them in. 1290 compilerConfig = 1291 pkgs.runCommand "hackage2nix-${self.ghc.haskellCompilerName}-config.yaml" 1292 { 1293 nativeBuildInputs = [ 1294 self.ghc 1295 ]; 1296 } 1297 '' 1298 cat > "$out" << EOF 1299 # generated by haskellPackages.cabal2nix-unstable.compilerConfig 1300 compiler: ${self.ghc.haskellCompilerName} 1301 1302 core-packages: 1303 EOF 1304 1305 ghc-pkg list \ 1306 | tail -n '+2' \ 1307 | sed -e 's/[()]//g' -e 's/\s\+/ - /' \ 1308 >> "$out" 1309 ''; 1310 }; 1311 }) (justStaticExecutables super.cabal2nix-unstable); 1312 1313 # test suite needs local redis daemon 1314 nri-redis = dontCheck super.nri-redis; 1315 1316 # Make tophat find itself for _compiling_ its test suite 1317 tophat = overrideCabal (drv: { 1318 postPatch = '' 1319 sed -i 's|"tophat"|"./dist/build/tophat/tophat"|' app-test-bin/*.hs 1320 '' 1321 + (drv.postPatch or ""); 1322 }) super.tophat; 1323 1324 # Runtime dependencies and CLI completion 1325 nvfetcher = self.generateOptparseApplicativeCompletions [ "nvfetcher" ] ( 1326 overrideCabal (drv: { 1327 # test needs network 1328 doCheck = false; 1329 buildTools = drv.buildTools or [ ] ++ [ pkgs.buildPackages.makeWrapper ]; 1330 postInstall = 1331 drv.postInstall or "" 1332 + '' 1333 wrapProgram "$out/bin/nvfetcher" --prefix 'PATH' ':' "${ 1334 pkgs.lib.makeBinPath [ 1335 pkgs.nvchecker 1336 pkgs.nix # nix-prefetch-url 1337 pkgs.nix-prefetch-git 1338 pkgs.nix-prefetch-docker 1339 ] 1340 }" 1341 '' 1342 # Prevent erroneous references to other libraries that use Paths_ modules 1343 # on aarch64-darwin. Note that references to the data outputs are not removed. 1344 + lib.optionalString (with pkgs.stdenv; hostPlatform.isDarwin && hostPlatform.isAarch64) '' 1345 remove-references-to -t "${self.shake.out}" "$out/bin/.nvfetcher-wrapped" 1346 remove-references-to -t "${self.js-jquery.out}" "$out/bin/.nvfetcher-wrapped" 1347 remove-references-to -t "${self.js-flot.out}" "$out/bin/.nvfetcher-wrapped" 1348 remove-references-to -t "${self.js-dgtable.out}" "$out/bin/.nvfetcher-wrapped" 1349 ''; 1350 }) super.nvfetcher 1351 ); 1352 1353 rel8 = pkgs.lib.pipe super.rel8 [ 1354 (addTestToolDepend pkgs.postgresql) 1355 # https://github.com/NixOS/nixpkgs/issues/198495 1356 (dontCheckIf (!pkgs.postgresql.doInstallCheck)) 1357 ]; 1358 1359 cloudy = pkgs.lib.pipe super.cloudy [ 1360 # The code-path that generates the optparse-applicative completions uses 1361 # the HOME directory, so that must be set in order to generate completions. 1362 # https://github.com/cdepillabout/cloudy/issues/10 1363 (overrideCabal (oldAttrs: { 1364 postInstall = '' 1365 export HOME=$TMPDIR 1366 '' 1367 + (oldAttrs.postInstall or ""); 1368 })) 1369 (self.generateOptparseApplicativeCompletions [ "cloudy" ]) 1370 ]; 1371 1372 # We don't have multiple GHC versions to test against in PATH 1373 ghc-hie = overrideCabal (drv: { 1374 testFlags = drv.testFlags or [ ] ++ [ 1375 "--skip=/GHC.Iface.Ext.Binary/readHieFile" 1376 ]; 1377 }) super.ghc-hie; 1378 1379 # Wants running postgresql database accessible over ip, so postgresqlTestHook 1380 # won't work (or would need to patch test suite). 1381 domaindriven-core = dontCheck super.domaindriven-core; 1382 1383 cachix = self.generateOptparseApplicativeCompletions [ "cachix" ] ( 1384 enableSeparateBinOutput super.cachix 1385 ); 1386 1387 hercules-ci-agent = super.hercules-ci-agent.override { 1388 nix = self.hercules-ci-cnix-store.passthru.nixPackage; 1389 }; 1390 hercules-ci-cnix-expr = addTestToolDepend pkgs.git ( 1391 super.hercules-ci-cnix-expr.override { nix = self.hercules-ci-cnix-store.passthru.nixPackage; } 1392 ); 1393 hercules-ci-cnix-store = 1394 overrideCabal 1395 (old: { 1396 passthru = old.passthru or { } // { 1397 nixPackage = pkgs.nixVersions.nix_2_28; 1398 }; 1399 }) 1400 ( 1401 super.hercules-ci-cnix-store.override { 1402 nix = self.hercules-ci-cnix-store.passthru.nixPackage; 1403 } 1404 ); 1405 1406 # the testsuite fails because of not finding tsc without some help 1407 aeson-typescript = overrideCabal (drv: { 1408 testToolDepends = drv.testToolDepends or [ ] ++ [ pkgs.typescript ]; 1409 # the testsuite assumes that tsc is in the PATH if it thinks it's in 1410 # CI, otherwise trying to install it. 1411 # 1412 # https://github.com/codedownio/aeson-typescript/blob/ee1a87fcab8a548c69e46685ce91465a7462be89/test/Util.hs#L27-L33 1413 preCheck = "export CI=true"; 1414 }) super.aeson-typescript; 1415 1416 Agda = lib.pipe super.Agda [ 1417 # Enable extra optimisations which increase build time, but also 1418 # later compiler performance, so we should do this for user's benefit. 1419 # Flag added in Agda 2.6.2 1420 (enableCabalFlag "optimise-heavily") 1421 # Enable debug printing, which worsens performance slightly but is 1422 # very useful. 1423 # Flag added in Agda 2.6.4.1, was always enabled before 1424 (enableCabalFlag "debug") 1425 # Set the main program 1426 (overrideCabal { mainProgram = "agda"; }) 1427 # Split outputs to reduce closure size 1428 enableSeparateBinOutput 1429 # Build the primitive library to generate its interface files. 1430 # These are needed in order to use Agda in Nix builds. 1431 (overrideCabal (drv: { 1432 postInstall = drv.postInstall or "" + '' 1433 agdaExe=''${bin:-$out}/bin/agda 1434 1435 echo "Generating Agda core library interface files..." 1436 (cd "$("$agdaExe" --print-agda-data-dir)/lib/prim" && "$agdaExe" --build-library) 1437 ''; 1438 })) 1439 ]; 1440 1441 # ats-format uses cli-setup in Setup.hs which is quite happy to write 1442 # to arbitrary files in $HOME. This doesn't either not achieve anything 1443 # or even fail, so we prevent it and install everything necessary ourselves. 1444 # See also: https://hackage.haskell.org/package/cli-setup-0.2.1.4/docs/src/Distribution.CommandLine.html#setManpathGeneric 1445 ats-format = self.generateOptparseApplicativeCompletions [ "atsfmt" ] ( 1446 justStaticExecutables ( 1447 overrideCabal (drv: { 1448 # use vanilla Setup.hs 1449 preCompileBuildDriver = '' 1450 cat > Setup.hs << EOF 1451 module Main where 1452 import Distribution.Simple 1453 main = defaultMain 1454 EOF 1455 '' 1456 + (drv.preCompileBuildDriver or ""); 1457 # install man page 1458 buildTools = [ 1459 pkgs.buildPackages.installShellFiles 1460 ] 1461 ++ (drv.buildTools or [ ]); 1462 postInstall = '' 1463 installManPage man/atsfmt.1 1464 '' 1465 + (drv.postInstall or ""); 1466 }) super.ats-format 1467 ) 1468 ); 1469 1470 # Some hash implementations are x86 only, but part of the test suite. 1471 # So executing and building it on non-x86 platforms will always fail. 1472 hashes = dontCheckIf (!pkgs.stdenv.hostPlatform.isx86) super.hashes; 1473 1474 # Tries to access network 1475 aws-sns-verify = dontCheck super.aws-sns-verify; 1476 1477 # Test suite requires network access 1478 minicurl = dontCheck super.minicurl; 1479 1480 # procex relies on close_range which has been introduced in Linux 5.9, 1481 # the test suite seems to force the use of this feature (or the fallback 1482 # mechanism is broken), so we can't run the test suite on machines with a 1483 # Kernel < 5.9. To check for this, we use uname -r to obtain the Kernel 1484 # version and sort -V to compare against our minimum version. If the 1485 # Kernel turns out to be older, we disable the test suite. 1486 procex = overrideCabal (drv: { 1487 postConfigure = '' 1488 minimumKernel=5.9 1489 higherVersion=`printf "%s\n%s\n" "$minimumKernel" "$(uname -r)" | sort -rV | head -n1` 1490 if [[ "$higherVersion" = "$minimumKernel" ]]; then 1491 echo "Used Kernel doesn't support close_range, disabling tests" 1492 unset doCheck 1493 fi 1494 '' 1495 + (drv.postConfigure or ""); 1496 }) super.procex; 1497 1498 # Test suite wants to run main executable 1499 # https://github.com/fourmolu/fourmolu/issues/231 1500 inherit 1501 ( 1502 let 1503 fourmoluTestFix = overrideCabal (drv: { 1504 preCheck = drv.preCheck or "" + '' 1505 export PATH="$PWD/dist/build/fourmolu:$PATH" 1506 ''; 1507 }); 1508 in 1509 builtins.mapAttrs (_: fourmoluTestFix) super 1510 ) 1511 fourmolu 1512 fourmolu_0_14_0_0 1513 fourmolu_0_16_0_0 1514 fourmolu_0_18_0_0 1515 ; 1516 1517 # Test suite needs to execute 'disco' binary 1518 disco = overrideCabal (drv: { 1519 preCheck = drv.preCheck or "" + '' 1520 export PATH="$PWD/dist/build/disco:$PATH" 1521 ''; 1522 testFlags = drv.testFlags or [ ] ++ [ 1523 # Needs network access 1524 "-p" 1525 "!/oeis/" 1526 ]; 1527 # disco-examples needs network access 1528 testTargets = [ "disco-tests" ]; 1529 }) super.disco; 1530 1531 # Apply a patch which hardcodes the store path of graphviz instead of using 1532 # whatever graphviz is in PATH. 1533 graphviz = overrideCabal (drv: { 1534 patches = [ 1535 (pkgs.replaceVars ./patches/graphviz-hardcode-graphviz-store-path.patch { 1536 inherit (pkgs) graphviz; 1537 # patch context 1538 dot = null; 1539 PATH = null; 1540 }) 1541 ] 1542 ++ (drv.patches or [ ]); 1543 }) super.graphviz; 1544 1545 # Test suite requires AWS access which requires both a network 1546 # connection and payment. 1547 aws = dontCheck super.aws; 1548 1549 # Test case tries to contact the network 1550 http-api-data-qq = overrideCabal (drv: { 1551 testFlags = [ 1552 "-p" 1553 "!/Can be used with http-client/" 1554 ] 1555 ++ drv.testFlags or [ ]; 1556 }) super.http-api-data-qq; 1557 1558 # Test have become more fussy in >= 2.0. We need to have which available for 1559 # tests to succeed and the makefile no longer finds happy by itself. 1560 inherit 1561 (lib.mapAttrs 1562 ( 1563 _: 1564 overrideCabal (drv: { 1565 buildTools = drv.buildTools or [ ] ++ [ pkgs.buildPackages.which ]; 1566 preCheck = drv.preCheck or "" + '' 1567 export PATH="$PWD/dist/build/happy:$PATH" 1568 ''; 1569 }) 1570 ) 1571 { 1572 inherit (super) happy; 1573 happy_2_1_5 = super.happy_2_1_5.override { 1574 happy-lib = self.happy-lib_2_1_5; 1575 }; 1576 } 1577 ) 1578 happy_2_1_5 1579 happy 1580 ; 1581 1582 # Additionally install documentation 1583 jacinda = overrideCabal (drv: { 1584 enableSeparateDocOutput = true; 1585 # Test suite is broken by DOS line endings inserted by Hackage revisions 1586 # https://github.com/vmchale/jacinda/issues/5 1587 postPatch = '' 1588 ${drv.postPatch or ""} 1589 ${pkgs.buildPackages.dos2unix}/bin/dos2unix *.cabal 1590 ''; 1591 postInstall = '' 1592 ${drv.postInstall or ""} 1593 1594 docDir="$doc/share/doc/${drv.pname}-${drv.version}" 1595 1596 # man page goes to $out, it's small enough and haskellPackages has no 1597 # support for a man output at the moment and $doc requires downloading 1598 # a full PDF 1599 install -Dm644 man/ja.1 -t "$out/share/man/man1" 1600 # language guide and examples 1601 install -Dm644 doc/guide.pdf -t "$docDir" 1602 install -Dm644 test/examples/*.jac -t "$docDir/examples" 1603 ''; 1604 }) super.jacinda; 1605 1606 # Needs network access 1607 pinecone = dontCheck super.pinecone; 1608 1609 # Smoke test can't be executed in sandbox 1610 # https://github.com/georgefst/evdev/issues/25 1611 evdev = overrideCabal (drv: { 1612 testFlags = drv.testFlags or [ ] ++ [ 1613 "-p" 1614 "!/Smoke/" 1615 ]; 1616 }) super.evdev; 1617 1618 # Tests assume dist-newstyle build directory is present 1619 cabal-hoogle = dontCheck super.cabal-hoogle; 1620 1621 nfc = lib.pipe super.nfc [ 1622 enableSeparateBinOutput 1623 (addBuildDepend self.base16-bytestring) 1624 (appendConfigureFlag "-fbuild-examples") 1625 ]; 1626 1627 # Wants to execute cabal-install to (re-)build itself 1628 hint = dontCheck super.hint; 1629 1630 # cabal-install switched to build type simple in 3.2.0.0 1631 # as a result, the cabal(1) man page is no longer installed 1632 # automatically. Instead we need to use the `cabal man` 1633 # command which generates the man page on the fly and 1634 # install it to $out/share/man/man1 ourselves in this 1635 # override. 1636 # The commit that introduced this change: 1637 # https://github.com/haskell/cabal/commit/91ac075930c87712eeada4305727a4fa651726e7 1638 # Since cabal-install 3.8, the cabal man (without the raw) command 1639 # uses nroff(1) instead of man(1) for macOS/BSD compatibility. That utility 1640 # is not commonly installed on systems, so we add it to PATH. Closure size 1641 # penalty is about 10MB at the time of writing this (2022-08-20). 1642 cabal-install = overrideCabal (old: { 1643 buildTools = [ 1644 pkgs.buildPackages.makeWrapper 1645 ] 1646 ++ old.buildTools or [ ]; 1647 postInstall = old.postInstall + '' 1648 mkdir -p "$out/share/man/man1" 1649 "$out/bin/cabal" man --raw > "$out/share/man/man1/cabal.1" 1650 1651 wrapProgram "$out/bin/cabal" \ 1652 --prefix PATH : "${pkgs.lib.makeBinPath [ pkgs.groff ]}" 1653 ''; 1654 hydraPlatforms = pkgs.lib.platforms.all; 1655 broken = false; 1656 }) super.cabal-install; 1657 1658 tailwind = 1659 addBuildDepend 1660 # Overrides for tailwindcss copied from: 1661 # https://github.com/EmaApps/emanote/blob/master/nix/tailwind.nix 1662 (pkgs.tailwindcss.overrideAttrs (oa: { 1663 plugins = [ 1664 pkgs.nodePackages."@tailwindcss/aspect-ratio" 1665 pkgs.nodePackages."@tailwindcss/forms" 1666 pkgs.nodePackages."@tailwindcss/line-clamp" 1667 pkgs.nodePackages."@tailwindcss/typography" 1668 ]; 1669 # Added a shim for the `tailwindcss` CLI entry point 1670 nativeBuildInputs = (oa.nativeBuildInputs or [ ]) ++ [ pkgs.buildPackages.makeBinaryWrapper ]; 1671 postInstall = (oa.postInstall or "") + '' 1672 nodePath="" 1673 for p in "$out" "${pkgs.nodePackages.postcss}" $plugins; do 1674 nodePath="$nodePath''${nodePath:+:}$p/lib/node_modules" 1675 done 1676 makeWrapper "$out/bin/tailwindcss" "$out/bin/tailwind" --prefix NODE_PATH : "$nodePath" 1677 unset nodePath 1678 ''; 1679 })) 1680 super.tailwind; 1681 1682 emanote = addBuildDepend pkgs.stork super.emanote; 1683 1684 keid-render-basic = addBuildTool pkgs.glslang super.keid-render-basic; 1685 1686 # Disable checks to break dependency loop with SCalendar 1687 scalendar = dontCheck super.scalendar; 1688 1689 # Make sure we build xz against nixpkgs' xz package instead of 1690 # Hackage repackaging of the upstream sources. 1691 xz = enableCabalFlag "system-xz" super.xz; 1692 xz-clib = dontDistribute super.xz-clib; 1693 lzma-static = dontDistribute super.lzma-static; # deprecated 1694 1695 halide-haskell = super.halide-haskell.override { Halide = pkgs.halide; }; 1696 1697 feedback = self.generateOptparseApplicativeCompletions [ "feedback" ] ( 1698 enableSeparateBinOutput super.feedback 1699 ); 1700 1701 # Sydtest has a brittle test suite that will only work with the exact 1702 # versions that it ships with. 1703 sydtest = dontCheck super.sydtest; 1704 1705 # Prevent argv limit being exceeded when invoking $CC. 1706 inherit 1707 (lib.mapAttrs ( 1708 _: 1709 overrideCabal { 1710 __onlyPropagateKnownPkgConfigModules = true; 1711 } 1712 ) super) 1713 gi-javascriptcore 1714 gi-javascriptcore4 1715 gi-javascriptcore6 1716 gi-webkit2webextension 1717 gi-gtk_4_0_12 1718 gi-gdk_4_0_10 1719 gi-gdk4 1720 gi-gdkx114 1721 gi-gtk4 1722 gi-gtksource5 1723 gi-gsk 1724 gi-adwaita 1725 sdl2-ttf 1726 sdl2 1727 dear-imgui 1728 libremidi 1729 ; 1730 1731 webkit2gtk3-javascriptcore = lib.pipe super.webkit2gtk3-javascriptcore [ 1732 (addBuildDepend pkgs.xorg.libXtst) 1733 (addBuildDepend pkgs.lerc) 1734 (overrideCabal { __onlyPropagateKnownPkgConfigModules = true; }) 1735 ]; 1736 1737 gi-webkit2 = lib.pipe super.gi-webkit2 [ 1738 (addBuildDepend pkgs.xorg.libXtst) 1739 (addBuildDepend pkgs.lerc) 1740 (overrideCabal { __onlyPropagateKnownPkgConfigModules = true; }) 1741 ]; 1742 1743 jsaddle-warp = addTestToolDepends [ pkgs.nodejs ] super.jsaddle-warp; 1744 1745 # Makes the mpi-hs package respect the choice of mpi implementation in Nixpkgs. 1746 # Also adds required test dependencies for checks to pass 1747 mpi-hs = 1748 let 1749 validMpi = [ 1750 "openmpi" 1751 "mpich" 1752 "mvapich" 1753 ]; 1754 mpiImpl = pkgs.mpi.pname; 1755 disableUnused = with builtins; map disableCabalFlag (filter (n: n != mpiImpl) validMpi); 1756 in 1757 lib.pipe (super.mpi-hs.override { ompi = pkgs.mpi; }) ( 1758 [ 1759 (addTestToolDepends [ 1760 pkgs.openssh 1761 pkgs.mpiCheckPhaseHook 1762 ]) 1763 ] 1764 ++ disableUnused 1765 ++ lib.optional (builtins.elem mpiImpl validMpi) (enableCabalFlag mpiImpl) 1766 ); 1767 inherit 1768 (lib.mapAttrs ( 1769 _: 1770 addTestToolDepends [ 1771 pkgs.openssh 1772 pkgs.mpiCheckPhaseHook 1773 ] 1774 ) super) 1775 mpi-hs-store 1776 mpi-hs-cereal 1777 mpi-hs-binary 1778 ; 1779 1780 postgresql-libpq = lib.pipe super.postgresql-libpq [ 1781 (x: x.override { postgresql-libpq-configure = null; }) 1782 (appendConfigureFlag "-fuse-pkg-config") 1783 (addBuildDepend self.postgresql-libpq-pkgconfig) 1784 ]; 1785 1786 postgresql-libpq-configure = overrideCabal (drv: { 1787 librarySystemDepends = (drv.librarySystemDepends or [ ]) ++ [ pkgs.libpq ]; 1788 libraryToolDepends = (drv.libraryToolDepends or [ ]) ++ [ pkgs.libpq.pg_config ]; 1789 }) super.postgresql-libpq-configure; 1790 1791 postgresql-libpq-pkgconfig = addPkgconfigDepend pkgs.libpq super.postgresql-libpq-pkgconfig; 1792 1793 HDBC-postgresql = overrideCabal (drv: { 1794 libraryToolDepends = (drv.libraryToolDepends or [ ]) ++ [ pkgs.libpq.pg_config ]; 1795 }) super.HDBC-postgresql; 1796 1797 # Test failure is related to a GHC implementation detail of primitives and doesn't 1798 # cause actual problems in dependent packages, see https://github.com/lehins/pvar/issues/4 1799 pvar = dontCheck super.pvar; 1800 1801 kmonad = lib.pipe super.kmonad [ 1802 enableSeparateBinOutput 1803 (overrideCabal (drv: { 1804 passthru = lib.recursiveUpdate drv.passthru or { } { tests.nixos = pkgs.nixosTests.kmonad; }; 1805 })) 1806 ]; 1807 1808 xmobar = enableSeparateBinOutput super.xmobar; 1809 1810 # These test cases access the network 1811 hpack_0_38_1 = doDistribute ( 1812 overrideCabal (drv: { 1813 testFlags = drv.testFlags or [ ] ++ [ 1814 "--skip" 1815 "/Hpack.Defaults/ensureFile/with 404/does not create any files/" 1816 "--skip" 1817 "/Hpack.Defaults/ensureFile/downloads file if missing/" 1818 "--skip" 1819 "/EndToEnd/hpack/defaults/fails if defaults don't exist/" 1820 ]; 1821 }) super.hpack_0_38_1 1822 ); 1823 1824 # 2024-08-09: Disable some cabal-doctest tests pending further investigation. 1825 inherit 1826 (lib.mapAttrs ( 1827 _: doctest: 1828 lib.pipe doctest [ 1829 (overrideCabal (drv: { 1830 patches = drv.patches or [ ] ++ [ 1831 (pkgs.fetchpatch { 1832 name = "doctest-0.23.0-ghc-9.12.patch"; 1833 url = "https://github.com/sol/doctest/commit/77373c5d84cd5e59ea86ec30b9ada874f50fad9e.patch"; 1834 sha256 = "07dx99lna17fni1ccbklijx1ckkf2p4kk9wvkwib0ihmra70zpn2"; 1835 includes = [ "test/**" ]; 1836 }) 1837 ]; 1838 testFlags = drv.testFlags or [ ] ++ [ 1839 # These tests require cabal-install (would cause infinite recursion) 1840 "--skip=/Cabal.Options" 1841 "--skip=/Cabal.Paths/paths" 1842 "--skip=/Cabal.ReplOptions" # >= 0.23 1843 ]; 1844 })) 1845 doDistribute 1846 ] 1847 ) { inherit (super) doctest doctest_0_23_0; }) 1848 doctest 1849 doctest_0_23_0 1850 ; 1851 1852 # tracked upstream: https://github.com/snapframework/openssl-streams/pull/11 1853 # certificate used only 1024 Bit RSA key and SHA-1, which is not allowed in OpenSSL 3.1+ 1854 # security level 2 1855 openssl-streams = appendPatch ./patches/openssl-streams-cert.patch super.openssl-streams; 1856 1857 libtorch-ffi = 1858 appendConfigureFlags 1859 ( 1860 [ 1861 "--extra-include-dirs=${lib.getDev pkgs.libtorch-bin}/include/torch/csrc/api/include" 1862 ] 1863 ++ (lib.optionals pkgs.config.cudaSupport [ 1864 "-f" 1865 "cuda" 1866 ]) 1867 ) 1868 ( 1869 super.libtorch-ffi.override ({ 1870 c10 = pkgs.libtorch-bin; 1871 torch = pkgs.libtorch-bin; 1872 torch_cpu = pkgs.libtorch-bin; 1873 }) 1874 ); 1875 1876 # Upper bounds of text and bytestring too strict: https://github.com/zsedem/haskell-cpython/pull/24 1877 cpython = doJailbreak super.cpython; 1878 1879 botan-bindings = super.botan-bindings.override { botan = pkgs.botan3; }; 1880}