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