Clone of https://github.com/NixOS/nixpkgs.git (to stress-test knotserver)
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_17.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 =
343 (overrideCabal (old: {
344 src = pkgs.fetchFromGitHub {
345 repo = "nix-serve-ng";
346 owner = "aristanetworks";
347 rev = "6e8d82a451fccbaa4714da8f7a3db5907bdfa96d";
348 hash = "sha256-Ht5wD/n2I/tQWNgYIdmi3UQbm1FNwp9m9JmDjZEd6ng=";
349 };
350 version = "1.0.0-unstable-2024-12-02";
351 #editedCabalFile = null;
352 # Doesn't declare boost dependency
353 pkg-configDepends = (old.pkg-configDepends or [ ]) ++ [ pkgs.boost.dev ];
354 # error: output '/nix/store/hv6lzj1nlshn8q5lirzgys8f4vgym4hg-nix-serve-ng-1.0.0-unstable-2024-12-02' is not allowed to refer to the following paths:
355 # /nix/store/qza2y18fwkq1wzi02qywf691r42r5jfy-ghc-9.6.6
356 broken = pkgs.stdenv.hostPlatform.system == "aarch64-darwin";
357 }) super.nix-serve-ng).override
358 {
359 nix = pkgs.nixVersions.nix_2_24;
360 };
361
362 # These packages try to access the network.
363 amqp = dontCheck super.amqp;
364 amqp-conduit = dontCheck super.amqp-conduit;
365 bitcoin-api = dontCheck super.bitcoin-api;
366 bitcoin-api-extra = dontCheck super.bitcoin-api-extra;
367 bitx-bitcoin = dontCheck super.bitx-bitcoin; # http://hydra.cryp.to/build/926187/log/raw
368 concurrent-dns-cache = dontCheck super.concurrent-dns-cache;
369 digitalocean-kzs = dontCheck super.digitalocean-kzs; # https://github.com/KazumaSATO/digitalocean-kzs/issues/1
370 github-types = dontCheck super.github-types; # http://hydra.cryp.to/build/1114046/nixlog/1/raw
371 hadoop-rpc = dontCheck super.hadoop-rpc; # http://hydra.cryp.to/build/527461/nixlog/2/raw
372 hjsonschema = overrideCabal (drv: { testTargets = [ "local" ]; }) super.hjsonschema;
373 marmalade-upload = dontCheck super.marmalade-upload; # http://hydra.cryp.to/build/501904/nixlog/1/raw
374 mongoDB = dontCheck super.mongoDB;
375 network-transport-zeromq = dontCheck super.network-transport-zeromq; # https://github.com/tweag/network-transport-zeromq/issues/30
376 oidc-client = dontCheck super.oidc-client; # the spec runs openid against google.com
377 persistent-migration = dontCheck super.persistent-migration; # spec requires pg_ctl binary
378 pipes-mongodb = dontCheck super.pipes-mongodb; # http://hydra.cryp.to/build/926195/log/raw
379 pixiv = dontCheck super.pixiv;
380 riak = dontCheck super.riak; # http://hydra.cryp.to/build/498763/log/raw
381 scotty-binding-play = dontCheck super.scotty-binding-play;
382 servant-router = dontCheck super.servant-router;
383 serversession-backend-redis = dontCheck super.serversession-backend-redis;
384 slack-api = dontCheck super.slack-api; # https://github.com/mpickering/slack-api/issues/5
385 stackage = dontCheck super.stackage; # http://hydra.cryp.to/build/501867/nixlog/1/raw
386 textocat-api = dontCheck super.textocat-api; # http://hydra.cryp.to/build/887011/log/raw
387 wreq = dontCheck super.wreq; # http://hydra.cryp.to/build/501895/nixlog/1/raw
388 wreq-sb = dontCheck super.wreq-sb; # http://hydra.cryp.to/build/783948/log/raw
389 download = dontCheck super.download;
390 http-client = dontCheck super.http-client;
391 http-client-openssl = dontCheck super.http-client-openssl;
392 http-client-tls = dontCheck super.http-client-tls;
393 http-conduit = dontCheck super.http-conduit;
394 transient-universe = dontCheck super.transient-universe;
395 telegraph = dontCheck super.telegraph;
396 js-jquery = dontCheck super.js-jquery;
397 hPDB-examples = dontCheck super.hPDB-examples;
398 tcp-streams = dontCheck super.tcp-streams;
399 holy-project = dontCheck super.holy-project;
400 mustache = dontCheck super.mustache;
401 arch-web = dontCheck super.arch-web;
402
403 # Tries accessing the GitHub API
404 github-app-token = dontCheck super.github-app-token;
405
406 # The curl executable is required for withApplication tests.
407 warp = addTestToolDepend pkgs.curl super.warp;
408
409 lz4-frame-conduit = addTestToolDepends [ pkgs.lz4 ] super.lz4-frame-conduit;
410
411 safe-exceptions = overrideCabal (drv: {
412 # Fix strictDeps build error "could not execute: hspec-discover"
413 testToolDepends = drv.testToolDepends or [ ] ++ [ self.hspec-discover ];
414 }) super.safe-exceptions;
415
416 # Test suite requires running a database server. Testing is done upstream.
417 hasql = dontCheck super.hasql;
418 hasql-dynamic-statements = dontCheck super.hasql-dynamic-statements;
419 hasql-interpolate = dontCheck super.hasql-interpolate;
420 hasql-notifications = dontCheck super.hasql-notifications;
421 hasql-pool = dontCheck super.hasql-pool;
422 hasql-transaction = dontCheck super.hasql-transaction;
423
424 # Avoid compiling twice by providing executable as a separate output (with small closure size),
425 postgres-websockets = lib.pipe super.postgres-websockets [
426 enableSeparateBinOutput
427 (overrideCabal { passthru.tests = pkgs.nixosTests.postgres-websockets; })
428 ];
429
430 # Test suite requires a running postgresql server,
431 # avoid compiling twice by providing executable as a separate output (with small closure size),
432 # generate shell completion
433 postgrest = lib.pipe super.postgrest [
434 dontCheck
435 enableSeparateBinOutput
436 (self.generateOptparseApplicativeCompletions [ "postgrest" ])
437 (overrideCabal { passthru.tests = pkgs.nixosTests.postgrest; })
438 ];
439
440 # Tries to mess with extended POSIX attributes, but can't in our chroot environment.
441 xattr = dontCheck super.xattr;
442
443 # Needs access to locale data, but looks for it in the wrong place.
444 scholdoc-citeproc = dontCheck super.scholdoc-citeproc;
445
446 # Disable tests because they require a mattermost server
447 mattermost-api = dontCheck super.mattermost-api;
448
449 # Expect to find sendmail(1) in $PATH.
450 mime-mail = appendConfigureFlag "--ghc-option=-DMIME_MAIL_SENDMAIL_PATH=\"sendmail\"" super.mime-mail;
451
452 # Help the test suite find system timezone data.
453 tz = addBuildDepends [ pkgs.tzdata ] super.tz;
454 tzdata = addBuildDepends [ pkgs.tzdata ] super.tzdata;
455
456 # https://hydra.nixos.org/build/128665302/nixlog/3
457 # Disable tests because they require a running dbus session
458 xmonad-dbus = dontCheck super.xmonad-dbus;
459
460 # Test suite requires running a docker container via testcontainers
461 amqp-streamly = dontCheck super.amqp-streamly;
462
463 # wxc supports wxGTX >= 3.0, but our current default version points to 2.8.
464 # http://hydra.cryp.to/build/1331287/log/raw
465 wxc = (addBuildDepend self.split super.wxc).override { wxGTK = pkgs.wxGTK32; };
466 wxcore = super.wxcore.override { wxGTK = pkgs.wxGTK32; };
467
468 shellify = enableSeparateBinOutput super.shellify;
469 specup = enableSeparateBinOutput super.specup;
470 aws-spend-summary = self.generateOptparseApplicativeCompletions [ "aws-spend-summary" ] (
471 enableSeparateBinOutput super.aws-spend-summary
472 );
473
474 # Test suite wants to connect to $DISPLAY.
475 bindings-GLFW = dontCheck super.bindings-GLFW;
476 gi-gtk-declarative = dontCheck super.gi-gtk-declarative;
477 gi-gtk-declarative-app-simple = dontCheck super.gi-gtk-declarative-app-simple;
478 hsqml = dontCheck (
479 addExtraLibraries [ pkgs.libGLU pkgs.libGL ] (super.hsqml.override { qt5 = pkgs.qt5Full; })
480 );
481 monomer = dontCheck super.monomer;
482
483 # Wants to check against a real DB, Needs freetds
484 odbc = dontCheck (addExtraLibraries [ pkgs.freetds ] super.odbc);
485
486 # Tests attempt to use NPM to install from the network into
487 # /homeless-shelter. Disabled.
488 purescript = dontCheck super.purescript;
489
490 # Hardcoded include path
491 poppler = overrideCabal (drv: {
492 postPatch = ''
493 sed -i -e 's,glib/poppler.h,poppler.h,' poppler.cabal
494 sed -i -e 's,glib/poppler.h,poppler.h,' Graphics/UI/Gtk/Poppler/Structs.hsc
495 '';
496 }) super.poppler;
497
498 # Uses OpenGL in testing
499 caramia = dontCheck super.caramia;
500
501 # llvm-ffi needs a specific version of LLVM which we hard code here. Since we
502 # can't use pkg-config (LLVM has no official .pc files), we need to pass the
503 # `dev` and `lib` output in, or Cabal will have trouble finding the library.
504 # Since it looks a bit neater having it in a list, we circumvent the singular
505 # LLVM input here.
506 llvm-ffi = addBuildDepends [
507 pkgs.llvmPackages_16.llvm.lib
508 pkgs.llvmPackages_16.llvm.dev
509 ] (super.llvm-ffi.override { LLVM = null; });
510
511 # Needs help finding LLVM.
512 spaceprobe = addBuildTool self.buildHaskellPackages.llvmPackages.llvm super.spaceprobe;
513
514 # Tries to run GUI in tests
515 leksah = dontCheck (
516 overrideCabal (drv: {
517 executableSystemDepends =
518 (drv.executableSystemDepends or [ ])
519 ++ (with pkgs; [
520 adwaita-icon-theme # Fix error: Icon 'window-close' not present in theme ...
521 wrapGAppsHook3 # Fix error: GLib-GIO-ERROR **: No GSettings schemas are installed on the system
522 gtk3 # Fix error: GLib-GIO-ERROR **: Settings schema 'org.gtk.Settings.FileChooser' is not installed
523 ]);
524 postPatch = (drv.postPatch or "") + ''
525 for f in src/IDE/Leksah.hs src/IDE/Utils/ServerConnection.hs
526 do
527 substituteInPlace "$f" --replace "\"leksah-server\"" "\"${self.leksah-server}/bin/leksah-server\""
528 done
529 '';
530 }) super.leksah
531 );
532
533 # dyre's tests appear to be trying to directly call GHC.
534 dyre = dontCheck super.dyre;
535
536 # https://github.com/edwinb/EpiVM/issues/13
537 # https://github.com/edwinb/EpiVM/issues/14
538 epic = addExtraLibraries [ pkgs.boehmgc pkgs.gmp ] (
539 addBuildTool self.buildHaskellPackages.happy super.epic
540 );
541
542 # https://github.com/ekmett/wl-pprint-terminfo/issues/7
543 wl-pprint-terminfo = addExtraLibrary pkgs.ncurses super.wl-pprint-terminfo;
544
545 # https://github.com/bos/pcap/issues/5
546 pcap = addExtraLibrary pkgs.libpcap super.pcap;
547
548 # https://github.com/NixOS/nixpkgs/issues/53336
549 greenclip = addExtraLibrary pkgs.xorg.libXdmcp super.greenclip;
550
551 # The cabal files for these libraries do not list the required system dependencies.
552 libjwt-typed = addExtraLibrary pkgs.libjwt super.libjwt-typed;
553 miniball = addExtraLibrary pkgs.miniball super.miniball;
554 SDL-image = addExtraLibrary pkgs.SDL super.SDL-image;
555 SDL-ttf = addExtraLibrary pkgs.SDL super.SDL-ttf;
556 SDL-mixer = addExtraLibrary pkgs.SDL super.SDL-mixer;
557 SDL-gfx = addExtraLibrary pkgs.SDL super.SDL-gfx;
558 SDL-mpeg = appendConfigureFlags [
559 "--extra-lib-dirs=${pkgs.smpeg}/lib"
560 "--extra-include-dirs=${pkgs.smpeg.dev}/include/smpeg"
561 ] super.SDL-mpeg;
562
563 # https://github.com/ivanperez-keera/hcwiid/pull/4
564 hcwiid = overrideCabal (drv: {
565 configureFlags = (drv.configureFlags or [ ]) ++ [
566 "--extra-lib-dirs=${pkgs.bluez.out}/lib"
567 "--extra-lib-dirs=${pkgs.cwiid}/lib"
568 "--extra-include-dirs=${pkgs.cwiid}/include"
569 "--extra-include-dirs=${pkgs.bluez.dev}/include"
570 ];
571 prePatch = ''sed -i -e "/Extra-Lib-Dirs/d" -e "/Include-Dirs/d" "hcwiid.cabal"'';
572 }) super.hcwiid;
573
574 # cabal2nix doesn't pick up some of the dependencies.
575 ginsu =
576 let
577 g = addBuildDepend pkgs.perl super.ginsu;
578 g' = overrideCabal (drv: {
579 executableSystemDepends = (drv.executableSystemDepends or [ ]) ++ [
580 pkgs.ncurses
581 ];
582 }) g;
583 in
584 g';
585
586 # Tests require `docker` command in PATH
587 # Tests require running docker service :on localhost
588 docker = dontCheck super.docker;
589
590 # https://github.com/deech/fltkhs/issues/16
591 fltkhs = overrideCabal (drv: {
592 libraryToolDepends = (drv.libraryToolDepends or [ ]) ++ [ pkgs.buildPackages.autoconf ];
593 librarySystemDepends = (drv.librarySystemDepends or [ ]) ++ [
594 pkgs.fltk13
595 pkgs.libGL
596 pkgs.libjpeg
597 ];
598 }) super.fltkhs;
599
600 # Select dependency discovery method and provide said dependency
601 jpeg-turbo = enableCabalFlag "pkgconfig" (
602 addPkgconfigDepends [ pkgs.libjpeg_turbo ] super.jpeg-turbo
603 );
604
605 # https://github.com/skogsbaer/hscurses/pull/26
606 hscurses = addExtraLibrary pkgs.ncurses super.hscurses;
607
608 # Looks like Avahi provides the missing library
609 dnssd = super.dnssd.override { dns_sd = pkgs.avahi.override { withLibdnssdCompat = true; }; };
610
611 # Tests execute goldplate
612 goldplate = overrideCabal (drv: {
613 preCheck = drv.preCheck or "" + ''
614 export PATH="$PWD/dist/build/goldplate:$PATH"
615 '';
616 }) super.goldplate;
617
618 # At least on 1.3.4 version on 32-bit architectures tasty requires
619 # unbounded-delays via .cabal file conditions.
620 tasty = overrideCabal (drv: {
621 libraryHaskellDepends =
622 (drv.libraryHaskellDepends or [ ])
623 ++
624 lib.optionals
625 (
626 !(pkgs.stdenv.hostPlatform.isAarch64 || pkgs.stdenv.hostPlatform.isx86_64)
627 || (self.ghc.isGhcjs or false)
628 )
629 [
630 self.unbounded-delays
631 ];
632 }) super.tasty;
633
634 tasty-discover = overrideCabal (drv: {
635 # Depends on itself for testing
636 preBuild = ''
637 export PATH="$PWD/dist/build/tasty-discover:$PATH"
638 ''
639 + (drv.preBuild or "");
640 }) super.tasty-discover;
641
642 # GLUT uses `dlopen` to link to freeglut, so we need to set the RUNPATH correctly for
643 # it to find `libglut.so` from the nix store. We do this by patching GLUT.cabal to pkg-config
644 # depend on freeglut, which provides GHC to necessary information to generate a correct RPATH.
645 #
646 # Note: Simply patching the dynamic library (.so) of the GLUT build will *not* work, since the
647 # RPATH also needs to be propagated when using static linking. GHC automatically handles this for
648 # us when we patch the cabal file (Link options will be recorded in the ghc package registry).
649 #
650 # Additional note: nixpkgs' freeglut and macOS's OpenGL implementation do not cooperate,
651 # so disable this on Darwin only
652 ${if pkgs.stdenv.hostPlatform.isDarwin then null else "GLUT"} = overrideCabal (drv: {
653 pkg-configDepends = drv.pkg-configDepends or [ ] ++ [
654 pkgs.freeglut
655 ];
656 patches = drv.patches or [ ] ++ [
657 ./patches/GLUT.patch
658 ];
659 prePatch = drv.prePatch or "" + ''
660 ${lib.getBin pkgs.buildPackages.dos2unix}/bin/dos2unix *.cabal
661 '';
662 }) super.GLUT;
663
664 libsystemd-journal = addExtraLibrary pkgs.systemd super.libsystemd-journal;
665
666 # does not specify tests in cabal file, instead has custom runTest cabal hook,
667 # so cabal2nix will not detect test dependencies.
668 either-unwrap = overrideCabal (drv: {
669 testHaskellDepends = (drv.testHaskellDepends or [ ]) ++ [
670 self.test-framework
671 self.test-framework-hunit
672 ];
673 }) super.either-unwrap;
674
675 hs-GeoIP = super.hs-GeoIP.override { GeoIP = pkgs.geoipWithDatabase; };
676
677 discount = super.discount.override { markdown = pkgs.discount; };
678
679 # tests require working stack installation with all-cabal-hashes cloned in $HOME
680 stackage-curator = dontCheck super.stackage-curator;
681
682 stack = self.generateOptparseApplicativeCompletions [ "stack" ] super.stack;
683
684 # hardcodes /usr/bin/tr: https://github.com/snapframework/io-streams/pull/59
685 io-streams = enableCabalFlag "NoInteractiveTests" super.io-streams;
686
687 # requires autotools to build
688 secp256k1 = addBuildTools [
689 pkgs.buildPackages.autoconf
690 pkgs.buildPackages.automake
691 pkgs.buildPackages.libtool
692 ] super.secp256k1;
693
694 # requires libsecp256k1 in pkg-config-depends
695 secp256k1-haskell = addPkgconfigDepend pkgs.secp256k1 super.secp256k1-haskell;
696
697 # tests require git and zsh
698 hapistrano = addBuildTools [ pkgs.buildPackages.git pkgs.buildPackages.zsh ] super.hapistrano;
699
700 # This propagates this to everything depending on haskell-gi-base
701 haskell-gi-base = addBuildDepend pkgs.gobject-introspection super.haskell-gi-base;
702
703 # requires valid, writeable $HOME
704 hatex-guide = overrideCabal (drv: {
705 preConfigure = ''
706 ${drv.preConfigure or ""}
707 export HOME=$PWD
708 '';
709 }) super.hatex-guide;
710
711 # https://github.com/plow-technologies/servant-streaming/issues/12
712 servant-streaming-server = dontCheck super.servant-streaming-server;
713
714 # https://github.com/haskell-servant/servant/pull/1238
715 servant-client-core =
716 if (pkgs.lib.getVersion super.servant-client-core) == "0.16" then
717 appendPatch ./patches/servant-client-core-redact-auth-header.patch super.servant-client-core
718 else
719 super.servant-client-core;
720
721 # tests run executable, relying on PATH
722 # without this, tests fail with "Couldn't launch intero process"
723 intero = overrideCabal (drv: {
724 preCheck = ''
725 export PATH="$PWD/dist/build/intero:$PATH"
726 '';
727 }) super.intero;
728
729 # Break infinite recursion cycle with criterion and network-uri.
730 js-flot = dontCheck super.js-flot;
731
732 # Break infinite recursion cycle between QuickCheck and splitmix.
733 splitmix = dontCheck super.splitmix;
734 splitmix_0_1_1 = dontCheck super.splitmix_0_1_1;
735
736 # Break infinite recursion cycle with OneTuple and quickcheck-instances.
737 foldable1-classes-compat = dontCheck super.foldable1-classes-compat;
738
739 # Break infinite recursion cycle between tasty and clock.
740 clock = dontCheck super.clock;
741
742 # Break infinite recursion cycle between devtools and mprelude.
743 devtools = super.devtools.override { mprelude = dontCheck super.mprelude; };
744
745 # Break dependency cycle between tasty-hedgehog and tasty-expected-failure
746 tasty-hedgehog = dontCheck super.tasty-hedgehog;
747
748 # Break dependency cycle between hedgehog, tasty-hedgehog and lifted-async
749 lifted-async = dontCheck super.lifted-async;
750
751 # loc and loc-test depend on each other for testing. Break that infinite cycle:
752 loc-test = super.loc-test.override { loc = dontCheck self.loc; };
753
754 # The test suites try to run the "fixpoint" and "liquid" executables built just
755 # before and fail because the library search paths aren't configured properly.
756 # Also needs https://github.com/ucsd-progsys/liquidhaskell/issues/1038 resolved.
757 liquid-fixpoint = disableSharedExecutables super.liquid-fixpoint;
758 liquidhaskell = dontCheck (disableSharedExecutables super.liquidhaskell);
759
760 # Break cyclic reference that results in an infinite recursion.
761 partial-semigroup = dontCheck super.partial-semigroup;
762 colour = dontCheck super.colour;
763 spatial-rotations = dontCheck super.spatial-rotations;
764
765 LDAP = dontCheck (
766 overrideCabal (drv: {
767 librarySystemDepends = drv.librarySystemDepends or [ ] ++ [ pkgs.cyrus_sasl.dev ];
768 }) super.LDAP
769 );
770
771 # Not running the "example" test because it requires a binary from lsps test
772 # suite which is not part of the output of lsp.
773 lsp-test = overrideCabal (old: {
774 testTargets = [
775 "tests"
776 "func-test"
777 ];
778 }) super.lsp-test;
779
780 # the test suite attempts to run the binaries built in this package
781 # through $PATH but they aren't in $PATH
782 dhall-lsp-server = dontCheck super.dhall-lsp-server;
783
784 # Test suite requires z3 to be in PATH
785 copilot-libraries = overrideCabal (drv: {
786 testToolDepends = drv.testToolDepends or [ ] ++ [
787 pkgs.z3
788 ];
789 }) super.copilot-libraries;
790 # tests need to execute the built executable
791 ogma-cli = overrideCabal (drv: {
792 preCheck = ''
793 export PATH=dist/build/ogma:$PATH
794 ''
795 + (drv.preCheck or "");
796 }) super.ogma-cli;
797
798 # Expects z3 to be on path so we replace it with a hard
799 #
800 # The tests expect additional solvers on the path, replace the
801 # available ones also with hard coded paths, and remove the missing
802 # ones from the test.
803 # TODO(@sternenseemann): package cvc5 and re-enable tests
804 sbv = overrideCabal (drv: {
805 postPatch = ''
806 sed -i -e 's|"abc"|"${pkgs.abc-verifier}/bin/abc"|' Data/SBV/Provers/ABC.hs
807 sed -i -e 's|"bitwuzla"|"${pkgs.bitwuzla}/bin/bitwuzla"|' Data/SBV/Provers/Bitwuzla.hs
808 sed -i -e 's|"boolector"|"${pkgs.boolector}/bin/boolector"|' Data/SBV/Provers/Boolector.hs
809 sed -i -e 's|"cvc4"|"${pkgs.cvc4}/bin/cvc4"|' Data/SBV/Provers/CVC4.hs
810 sed -i -e 's|"cvc5"|"${pkgs.cvc5}/bin/cvc5"|' Data/SBV/Provers/CVC5.hs
811 sed -i -e 's|"yices-smt2"|"${pkgs.yices}/bin/yices-smt2"|' Data/SBV/Provers/Yices.hs
812 sed -i -e 's|"z3"|"${pkgs.z3}/bin/z3"|' Data/SBV/Provers/Z3.hs
813
814 # Solvers we don't provide are removed from tests
815 sed -i -e 's|, mathSAT||' SBVTestSuite/SBVConnectionTest.hs
816 sed -i -e 's|, dReal||' SBVTestSuite/SBVConnectionTest.hs
817 '';
818 }) super.sbv;
819
820 # The test-suite requires a running PostgreSQL server.
821 Frames-beam = dontCheck super.Frames-beam;
822
823 # Test suite requires yices to be in PATH
824 crucible-symio = overrideCabal (drv: {
825 testToolDepends = drv.testToolDepends or [ ] ++ [
826 pkgs.yices
827 ];
828 }) super.crucible-symio;
829
830 # Test suite requires z3 to be in PATH
831 crucible-llvm = addTestToolDepends [
832 pkgs.z3
833 ] super.crucible-llvm;
834
835 # Compile manpages (which are in RST and are compiled with Sphinx).
836 futhark =
837 overrideCabal
838 (_drv: {
839 postBuild = (_drv.postBuild or "") + ''
840 make -C docs man
841 '';
842
843 postInstall = (_drv.postInstall or "") + ''
844 mkdir -p $out/share/man/man1
845 mv docs/_build/man/*.1 $out/share/man/man1/
846 '';
847 })
848 (
849 addBuildTools (with pkgs.buildPackages; [
850 makeWrapper
851 python3Packages.sphinx
852 ]) super.futhark
853 );
854
855 git-annex =
856 let
857 # Executables git-annex needs at runtime. git-annex detects these at configure
858 # time and expects to be able to execute them. This means that cross-compiling
859 # git-annex is not possible and strictDeps must be false (runtimeExecDeps go
860 # into executableSystemDepends/buildInputs).
861 runtimeExecDeps = [
862 pkgs.bup
863 pkgs.curl
864 pkgs.git
865 pkgs.gnupg
866 pkgs.lsof
867 pkgs.openssh
868 pkgs.perl
869 pkgs.rsync
870 pkgs.wget
871 pkgs.which
872 ];
873 in
874 overrideCabal
875 (drv: {
876 executableSystemDepends = runtimeExecDeps;
877 enableSharedExecutables = false;
878
879 # Unnecessary for Setup.hs, but we reuse the setup package db
880 # for the installation utilities.
881 setupHaskellDepends = drv.setupHaskellDepends or [ ] ++ [
882 self.buildHaskellPackages.unix-compat
883 self.buildHaskellPackages.IfElse
884 self.buildHaskellPackages.QuickCheck
885 self.buildHaskellPackages.data-default
886 ];
887
888 preConfigure = drv.preConfigure or "" + ''
889 export HOME=$TEMPDIR
890 patchShebangs .
891 '';
892
893 # git-annex ships its test suite as part of the final executable instead of
894 # using a Cabal test suite.
895 checkPhase = ''
896 runHook preCheck
897
898 # Setup PATH for the actual tests
899 ln -sf dist/build/git-annex/git-annex git-annex
900 ln -sf git-annex git-annex-shell
901 ln -sf git-annex git-remote-annex
902 ln -sf git-annex git-remote-tor-annex
903 PATH+=":$PWD"
904
905 echo checkFlags: $checkFlags ''${checkFlagsArray:+"''${checkFlagsArray[@]}"}
906
907 # Doesn't use Cabal's test mechanism
908 git-annex test $checkFlags ''${checkFlagsArray:+"''${checkFlagsArray[@]}"}
909
910 runHook postCheck
911 '';
912
913 # Use default installPhase of pkgs/stdenv/generic/setup.sh. We need to set
914 # the environment variables it uses via the preInstall hook since the Haskell
915 # generic builder doesn't accept them as arguments.
916 preInstall = drv.preInstall or "" + ''
917 installTargets="install"
918 installFlagsArray+=(
919 "PREFIX="
920 "DESTDIR=$out"
921 # Prevent Makefile from calling cabal/Setup again
922 "BUILDER=:"
923 # Make Haskell build dependencies available
924 "GHC=${self.buildHaskellPackages.ghc.targetPrefix}ghc -global-package-db -package-db $setupPackageConfDir"
925 )
926 '';
927 installPhase = null;
928
929 # Ensure git-annex uses the exact same coreutils it saw at build-time.
930 # This is especially important on Darwin but also in Linux environments
931 # where non-GNU coreutils are used by default.
932 postFixup = ''
933 wrapProgram $out/bin/git-annex \
934 --prefix PATH : "${
935 pkgs.lib.makeBinPath (
936 with pkgs;
937 [
938 coreutils
939 lsof
940 ]
941 )
942 }"
943 ''
944 + (drv.postFixup or "");
945 buildTools = [
946 pkgs.buildPackages.makeWrapper
947 ]
948 ++ (drv.buildTools or [ ]);
949
950 # Git annex provides a restricted login shell. Setting
951 # passthru.shellPath here allows a user's login shell to be set to
952 # `git-annex-shell` by making `shell = haskellPackages.git-annex`.
953 # https://git-annex.branchable.com/git-annex-shell/
954 passthru.shellPath = "/bin/git-annex-shell";
955 })
956 (
957 super.git-annex.override {
958 dbus = if pkgs.stdenv.hostPlatform.isLinux then self.dbus else null;
959 fdo-notify = if pkgs.stdenv.hostPlatform.isLinux then self.fdo-notify else null;
960 hinotify = if pkgs.stdenv.hostPlatform.isLinux then self.hinotify else self.fsnotify;
961 }
962 );
963
964 # The test suite has undeclared dependencies on git.
965 githash = dontCheck super.githash;
966
967 # Avoid infitite recursion with tonatona.
968 tonaparser = dontCheck super.tonaparser;
969
970 # Needs internet to run tests
971 HTTP = dontCheck super.HTTP;
972
973 # Break infinite recursions.
974 Dust-crypto = dontCheck super.Dust-crypto;
975 nanospec = dontCheck super.nanospec;
976 options = dontCheck super.options;
977 snap-server = dontCheck super.snap-server;
978
979 # Tests require internet
980 http-download = dontCheck super.http-download;
981 http-download_0_2_1_0 = doDistribute (dontCheck super.http-download_0_2_1_0);
982 pantry = dontCheck super.pantry;
983 pantry_0_9_3_1 = dontCheck super.pantry_0_9_3_1;
984 pantry_0_10_0 = dontCheck super.pantry_0_10_0;
985
986 # gtk2hs-buildtools is listed in setupHaskellDepends, but we
987 # need it during the build itself, too.
988 cairo = addBuildTool self.buildHaskellPackages.gtk2hs-buildtools super.cairo;
989 pango = disableHardening [ "fortify" ] (
990 addBuildTool self.buildHaskellPackages.gtk2hs-buildtools super.pango
991 );
992
993 spago =
994 let
995 docsSearchApp_0_0_10 = pkgs.fetchurl {
996 url = "https://github.com/purescript/purescript-docs-search/releases/download/v0.0.10/docs-search-app.js";
997 sha256 = "0m5ah29x290r0zk19hx2wix2djy7bs4plh9kvjz6bs9r45x25pa5";
998 };
999
1000 docsSearchApp_0_0_11 = pkgs.fetchurl {
1001 url = "https://github.com/purescript/purescript-docs-search/releases/download/v0.0.11/docs-search-app.js";
1002 sha256 = "17qngsdxfg96cka1cgrl3zdrpal8ll6vyhhnazqm4hwj16ywjm02";
1003 };
1004
1005 purescriptDocsSearch_0_0_10 = pkgs.fetchurl {
1006 url = "https://github.com/purescript/purescript-docs-search/releases/download/v0.0.10/purescript-docs-search";
1007 sha256 = "0wc1zyhli4m2yykc6i0crm048gyizxh7b81n8xc4yb7ibjqwhyj3";
1008 };
1009
1010 purescriptDocsSearch_0_0_11 = pkgs.fetchurl {
1011 url = "https://github.com/purescript/purescript-docs-search/releases/download/v0.0.11/purescript-docs-search";
1012 sha256 = "1hjdprm990vyxz86fgq14ajn0lkams7i00h8k2i2g1a0hjdwppq6";
1013 };
1014 in
1015 lib.pipe
1016 (super.spago.override {
1017 # base <4.19, text <2.1
1018 versions = doJailbreak self.versions_5_0_5;
1019 fsnotify = self.fsnotify_0_3_0_1;
1020 })
1021 [
1022 (overrideCabal (drv: {
1023 postUnpack = (drv.postUnpack or "") + ''
1024 # Spago includes the following two files directly into the binary
1025 # with Template Haskell. They are fetched at build-time from the
1026 # `purescript-docs-search` repo above. If they cannot be fetched at
1027 # build-time, they are pulled in from the `templates/` directory in
1028 # the spago source.
1029 #
1030 # However, they are not actually available in the spago source, so they
1031 # need to fetched with nix and put in the correct place.
1032 # https://github.com/spacchetti/spago/issues/510
1033 cp ${docsSearchApp_0_0_10} "$sourceRoot/templates/docs-search-app-0.0.10.js"
1034 cp ${docsSearchApp_0_0_11} "$sourceRoot/templates/docs-search-app-0.0.11.js"
1035 cp ${purescriptDocsSearch_0_0_10} "$sourceRoot/templates/purescript-docs-search-0.0.10"
1036 cp ${purescriptDocsSearch_0_0_11} "$sourceRoot/templates/purescript-docs-search-0.0.11"
1037
1038 # For some weird reason, on Darwin, the open(2) call to embed these files
1039 # requires write permissions. The easiest resolution is just to permit that
1040 # (doesn't cause any harm on other systems).
1041 chmod u+w \
1042 "$sourceRoot/templates/docs-search-app-0.0.10.js" \
1043 "$sourceRoot/templates/purescript-docs-search-0.0.10" \
1044 "$sourceRoot/templates/docs-search-app-0.0.11.js" \
1045 "$sourceRoot/templates/purescript-docs-search-0.0.11"
1046 '';
1047 }))
1048
1049 # Tests require network access.
1050 dontCheck
1051
1052 # Overly strict upper bound on text
1053 doJailbreak
1054
1055 # Generate shell completion for spago
1056 (self.generateOptparseApplicativeCompletions [ "spago" ])
1057 ];
1058
1059 # checks SQL statements at compile time, and so requires a running PostgreSQL
1060 # database to run it's test suite
1061 postgresql-typed = dontCheck super.postgresql-typed;
1062
1063 # mplayer-spot uses mplayer at runtime.
1064 mplayer-spot =
1065 let
1066 path = pkgs.lib.makeBinPath [ pkgs.mplayer ];
1067 in
1068 overrideCabal (oldAttrs: {
1069 postInstall = ''
1070 wrapProgram $out/bin/mplayer-spot --prefix PATH : "${path}"
1071 '';
1072 }) (addBuildTool pkgs.buildPackages.makeWrapper super.mplayer-spot);
1073
1074 # break infinite recursion with base-orphans
1075 primitive = dontCheck super.primitive;
1076 primitive_0_7_1_0 = dontCheck super.primitive_0_7_1_0;
1077
1078 cut-the-crap =
1079 let
1080 path = pkgs.lib.makeBinPath [
1081 pkgs.ffmpeg
1082 pkgs.youtube-dl
1083 ];
1084 in
1085 overrideCabal (_drv: {
1086 postInstall = ''
1087 wrapProgram $out/bin/cut-the-crap \
1088 --prefix PATH : "${path}"
1089 '';
1090 }) (addBuildTool pkgs.buildPackages.makeWrapper super.cut-the-crap);
1091
1092 # Compiling the readme throws errors and has no purpose in nixpkgs
1093 aeson-gadt-th = disableCabalFlag "build-readme" super.aeson-gadt-th;
1094
1095 # Fix compilation of Setup.hs by removing the module declaration.
1096 # See: https://github.com/tippenein/guid/issues/1
1097 guid = overrideCabal (drv: {
1098 prePatch = "sed -i '1d' Setup.hs"; # 1st line is module declaration, remove it
1099 doCheck = false;
1100 }) super.guid;
1101
1102 # Tests disabled as recommended at https://github.com/luke-clifton/shh/issues/39
1103 shh = dontCheck super.shh;
1104
1105 # The test suites fail because there's no PostgreSQL database running in our
1106 # build sandbox.
1107 hasql-queue = dontCheck super.hasql-queue;
1108 postgresql-libpq-notify = dontCheck super.postgresql-libpq-notify;
1109 postgresql-pure = dontCheck super.postgresql-pure;
1110
1111 # Needs PostgreSQL db during tests
1112 relocant = overrideCabal (drv: {
1113 preCheck = ''
1114 export postgresqlTestUserOptions="LOGIN SUPERUSER"
1115 export PGDATABASE=relocant
1116 '';
1117 testToolDepends = drv.testToolDepends or [ ] ++ [
1118 pkgs.postgresql
1119 pkgs.postgresqlTestHook
1120 ];
1121 }) super.relocant;
1122
1123 retrie = addTestToolDepends [ pkgs.git pkgs.mercurial ] super.retrie;
1124 retrie_1_2_0_0 = addTestToolDepends [ pkgs.git pkgs.mercurial ] super.retrie_1_2_0_0;
1125 retrie_1_2_1_1 = addTestToolDepends [ pkgs.git pkgs.mercurial ] super.retrie_1_2_1_1;
1126
1127 # Just an executable
1128 ret = enableSeparateBinOutput super.ret;
1129
1130 # there are three very heavy test suites that need external repos, one requires network access
1131 hevm = dontCheck super.hevm;
1132
1133 # hadolint enables static linking by default in the cabal file, so we have to explicitly disable it.
1134 # https://github.com/hadolint/hadolint/commit/e1305042c62d52c2af4d77cdce5d62f6a0a3ce7b
1135 hadolint = disableCabalFlag "static" super.hadolint;
1136
1137 # Test suite tries to execute the build product "doctest-driver-gen", but it's not in $PATH.
1138 doctest-driver-gen = dontCheck super.doctest-driver-gen;
1139
1140 # Tests access internet
1141 prune-juice = dontCheck super.prune-juice;
1142
1143 citeproc = lib.pipe super.citeproc [
1144 enableSeparateBinOutput
1145 # Enable executable being built and add missing dependencies
1146 (enableCabalFlag "executable")
1147 (addBuildDepends [ self.aeson-pretty ])
1148 # TODO(@sternenseemann): we may want to enable that for improved performance
1149 # Is correctness good enough since 0.5?
1150 (disableCabalFlag "icu")
1151 ];
1152
1153 # based on https://github.com/gibiansky/IHaskell/blob/aafeabef786154d81ab7d9d1882bbcd06fc8c6c4/release.nix
1154 ihaskell = overrideCabal (drv: {
1155 # ihaskell's cabal file forces building a shared executable, which we need
1156 # to reflect here or RPATH will contain a reference to /build/.
1157 enableSharedExecutables = true;
1158 preCheck = ''
1159 export HOME=$TMPDIR/home
1160 export PATH=$PWD/dist/build/ihaskell:$PATH
1161 export NIX_GHC_PACKAGE_PATH_FOR_TEST=$PWD/dist/package.conf.inplace/:$packageConfDir:
1162 '';
1163 }) super.ihaskell;
1164
1165 # tests need to execute the built executable
1166 stutter = overrideCabal (drv: {
1167 preCheck = ''
1168 export PATH=dist/build/stutter:$PATH
1169 ''
1170 + (drv.preCheck or "");
1171 }) super.stutter;
1172
1173 # Install man page and generate shell completions
1174 pinboard-notes-backup = overrideCabal (drv: {
1175 postInstall = ''
1176 install -D man/pnbackup.1 $out/share/man/man1/pnbackup.1
1177 ''
1178 + (drv.postInstall or "");
1179 }) (self.generateOptparseApplicativeCompletions [ "pnbackup" ] super.pinboard-notes-backup);
1180
1181 # Pass the correct libarchive into the package.
1182 streamly-archive = super.streamly-archive.override { archive = pkgs.libarchive; };
1183
1184 hlint = overrideCabal (drv: {
1185 postInstall = ''
1186 install -Dm644 data/hlint.1 -t "$out/share/man/man1"
1187 ''
1188 + drv.postInstall or "";
1189 }) super.hlint;
1190
1191 taglib = overrideCabal (drv: {
1192 librarySystemDepends = [
1193 pkgs.zlib
1194 ]
1195 ++ (drv.librarySystemDepends or [ ]);
1196 }) super.taglib;
1197
1198 # random 1.2.0 has tests that indirectly depend on
1199 # itself causing an infinite recursion at evaluation
1200 # time
1201 random = dontCheck super.random;
1202
1203 # https://github.com/Gabriella439/nix-diff/pull/74
1204 nix-diff = overrideCabal (drv: {
1205 postPatch = ''
1206 substituteInPlace src/Nix/Diff/Types.hs \
1207 --replace "{-# OPTIONS_GHC -Wno-orphans #-}" "{-# OPTIONS_GHC -Wno-orphans -fconstraint-solver-iterations=0 #-}"
1208 '';
1209 }) (dontCheck super.nix-diff);
1210
1211 # mockery's tests depend on hspec-discover which dependso on mockery for its tests
1212 mockery = dontCheck super.mockery;
1213 # same for logging-facade
1214 logging-facade = dontCheck super.logging-facade;
1215
1216 # Since this package is primarily used by nixpkgs maintainers and is probably
1217 # not used to link against by anyone, we can make it’s closure smaller and
1218 # add its runtime dependencies in `haskellPackages` (as opposed to cabal2nix).
1219 cabal2nix-unstable = overrideCabal (drv: {
1220 buildTools = (drv.buildTools or [ ]) ++ [
1221 pkgs.buildPackages.makeWrapper
1222 ];
1223 postInstall = ''
1224 ${drv.postInstall or ""}
1225
1226 wrapProgram $out/bin/cabal2nix \
1227 --prefix PATH ":" "${
1228 pkgs.lib.makeBinPath [
1229 pkgs.nix
1230 pkgs.nix-prefetch-scripts
1231 ]
1232 }"
1233 '';
1234 }) (justStaticExecutables super.cabal2nix-unstable);
1235
1236 # test suite needs local redis daemon
1237 nri-redis = dontCheck super.nri-redis;
1238
1239 # Make tophat find itself for _compiling_ its test suite
1240 tophat = overrideCabal (drv: {
1241 postPatch = ''
1242 sed -i 's|"tophat"|"./dist/build/tophat/tophat"|' app-test-bin/*.hs
1243 ''
1244 + (drv.postPatch or "");
1245 }) super.tophat;
1246
1247 # Runtime dependencies and CLI completion
1248 nvfetcher = self.generateOptparseApplicativeCompletions [ "nvfetcher" ] (
1249 overrideCabal (drv: {
1250 # test needs network
1251 doCheck = false;
1252 buildTools = drv.buildTools or [ ] ++ [ pkgs.buildPackages.makeWrapper ];
1253 postInstall =
1254 drv.postInstall or ""
1255 + ''
1256 wrapProgram "$out/bin/nvfetcher" --prefix 'PATH' ':' "${
1257 pkgs.lib.makeBinPath [
1258 pkgs.nvchecker
1259 pkgs.nix # nix-prefetch-url
1260 pkgs.nix-prefetch-git
1261 pkgs.nix-prefetch-docker
1262 ]
1263 }"
1264 ''
1265 # Prevent erroneous references to other libraries that use Paths_ modules
1266 # on aarch64-darwin. Note that references to the data outputs are not removed.
1267 + lib.optionalString (with pkgs.stdenv; hostPlatform.isDarwin && hostPlatform.isAarch64) ''
1268 remove-references-to -t "${self.shake.out}" "$out/bin/.nvfetcher-wrapped"
1269 remove-references-to -t "${self.js-jquery.out}" "$out/bin/.nvfetcher-wrapped"
1270 remove-references-to -t "${self.js-flot.out}" "$out/bin/.nvfetcher-wrapped"
1271 remove-references-to -t "${self.js-dgtable.out}" "$out/bin/.nvfetcher-wrapped"
1272 '';
1273 }) super.nvfetcher
1274 );
1275
1276 rel8 = pkgs.lib.pipe super.rel8 [
1277 (addTestToolDepend pkgs.postgresql)
1278 # https://github.com/NixOS/nixpkgs/issues/198495
1279 (dontCheckIf (!pkgs.postgresql.doInstallCheck))
1280 ];
1281
1282 cloudy = pkgs.lib.pipe super.cloudy [
1283 # The code-path that generates the optparse-applicative completions uses
1284 # the HOME directory, so that must be set in order to generate completions.
1285 # https://github.com/cdepillabout/cloudy/issues/10
1286 (overrideCabal (oldAttrs: {
1287 postInstall = ''
1288 export HOME=$TMPDIR
1289 ''
1290 + (oldAttrs.postInstall or "");
1291 }))
1292 (self.generateOptparseApplicativeCompletions [ "cloudy" ])
1293 ];
1294
1295 # Wants running postgresql database accessible over ip, so postgresqlTestHook
1296 # won't work (or would need to patch test suite).
1297 domaindriven-core = dontCheck super.domaindriven-core;
1298
1299 cachix = self.generateOptparseApplicativeCompletions [ "cachix" ] (
1300 enableSeparateBinOutput super.cachix
1301 );
1302
1303 hercules-ci-agent = super.hercules-ci-agent.override {
1304 nix = self.hercules-ci-cnix-store.passthru.nixPackage;
1305 };
1306 hercules-ci-cnix-expr = addTestToolDepend pkgs.git (
1307 super.hercules-ci-cnix-expr.override { nix = self.hercules-ci-cnix-store.passthru.nixPackage; }
1308 );
1309 hercules-ci-cnix-store =
1310 overrideCabal
1311 (old: {
1312 passthru = old.passthru or { } // {
1313 nixPackage = pkgs.nixVersions.nix_2_28;
1314 };
1315 })
1316 (
1317 super.hercules-ci-cnix-store.override {
1318 nix = self.hercules-ci-cnix-store.passthru.nixPackage;
1319 }
1320 );
1321
1322 # the testsuite fails because of not finding tsc without some help
1323 aeson-typescript = overrideCabal (drv: {
1324 testToolDepends = drv.testToolDepends or [ ] ++ [ pkgs.typescript ];
1325 # the testsuite assumes that tsc is in the PATH if it thinks it's in
1326 # CI, otherwise trying to install it.
1327 #
1328 # https://github.com/codedownio/aeson-typescript/blob/ee1a87fcab8a548c69e46685ce91465a7462be89/test/Util.hs#L27-L33
1329 preCheck = "export CI=true";
1330 }) super.aeson-typescript;
1331
1332 Agda = lib.pipe super.Agda [
1333 # Enable extra optimisations which increase build time, but also
1334 # later compiler performance, so we should do this for user's benefit.
1335 # Flag added in Agda 2.6.2
1336 (enableCabalFlag "optimise-heavily")
1337 # Enable debug printing, which worsens performance slightly but is
1338 # very useful.
1339 # Flag added in Agda 2.6.4.1, was always enabled before
1340 (enableCabalFlag "debug")
1341 # Set the main program
1342 (overrideCabal { mainProgram = "agda"; })
1343 # Split outputs to reduce closure size
1344 enableSeparateBinOutput
1345 ];
1346
1347 # ats-format uses cli-setup in Setup.hs which is quite happy to write
1348 # to arbitrary files in $HOME. This doesn't either not achieve anything
1349 # or even fail, so we prevent it and install everything necessary ourselves.
1350 # See also: https://hackage.haskell.org/package/cli-setup-0.2.1.4/docs/src/Distribution.CommandLine.html#setManpathGeneric
1351 ats-format = self.generateOptparseApplicativeCompletions [ "atsfmt" ] (
1352 justStaticExecutables (
1353 overrideCabal (drv: {
1354 # use vanilla Setup.hs
1355 preCompileBuildDriver = ''
1356 cat > Setup.hs << EOF
1357 module Main where
1358 import Distribution.Simple
1359 main = defaultMain
1360 EOF
1361 ''
1362 + (drv.preCompileBuildDriver or "");
1363 # install man page
1364 buildTools = [
1365 pkgs.buildPackages.installShellFiles
1366 ]
1367 ++ (drv.buildTools or [ ]);
1368 postInstall = ''
1369 installManPage man/atsfmt.1
1370 ''
1371 + (drv.postInstall or "");
1372 }) super.ats-format
1373 )
1374 );
1375
1376 # Some hash implementations are x86 only, but part of the test suite.
1377 # So executing and building it on non-x86 platforms will always fail.
1378 hashes = dontCheckIf (!pkgs.stdenv.hostPlatform.isx86) super.hashes;
1379
1380 # Tries to access network
1381 aws-sns-verify = dontCheck super.aws-sns-verify;
1382
1383 # Test suite requires network access
1384 minicurl = dontCheck super.minicurl;
1385
1386 # procex relies on close_range which has been introduced in Linux 5.9,
1387 # the test suite seems to force the use of this feature (or the fallback
1388 # mechanism is broken), so we can't run the test suite on machines with a
1389 # Kernel < 5.9. To check for this, we use uname -r to obtain the Kernel
1390 # version and sort -V to compare against our minimum version. If the
1391 # Kernel turns out to be older, we disable the test suite.
1392 procex = overrideCabal (drv: {
1393 postConfigure = ''
1394 minimumKernel=5.9
1395 higherVersion=`printf "%s\n%s\n" "$minimumKernel" "$(uname -r)" | sort -rV | head -n1`
1396 if [[ "$higherVersion" = "$minimumKernel" ]]; then
1397 echo "Used Kernel doesn't support close_range, disabling tests"
1398 unset doCheck
1399 fi
1400 ''
1401 + (drv.postConfigure or "");
1402 }) super.procex;
1403
1404 # Test suite wants to run main executable
1405 # https://github.com/fourmolu/fourmolu/issues/231
1406 inherit
1407 (
1408 let
1409 fourmoluTestFix = overrideCabal (drv: {
1410 preCheck = drv.preCheck or "" + ''
1411 export PATH="$PWD/dist/build/fourmolu:$PATH"
1412 '';
1413 });
1414 in
1415 builtins.mapAttrs (_: fourmoluTestFix) super
1416 )
1417 fourmolu
1418 fourmolu_0_14_0_0
1419 fourmolu_0_16_0_0
1420 fourmolu_0_18_0_0
1421 ;
1422
1423 # Test suite needs to execute 'disco' binary
1424 disco = overrideCabal (drv: {
1425 preCheck = drv.preCheck or "" + ''
1426 export PATH="$PWD/dist/build/disco:$PATH"
1427 '';
1428 testFlags = drv.testFlags or [ ] ++ [
1429 # Needs network access
1430 "-p"
1431 "!/oeis/"
1432 ];
1433 # disco-examples needs network access
1434 testTargets = [ "disco-tests" ];
1435 }) super.disco;
1436
1437 # Apply a patch which hardcodes the store path of graphviz instead of using
1438 # whatever graphviz is in PATH.
1439 graphviz = overrideCabal (drv: {
1440 patches = [
1441 (pkgs.replaceVars ./patches/graphviz-hardcode-graphviz-store-path.patch {
1442 inherit (pkgs) graphviz;
1443 # patch context
1444 dot = null;
1445 PATH = null;
1446 })
1447 ]
1448 ++ (drv.patches or [ ]);
1449 }) super.graphviz;
1450
1451 # Test suite requires AWS access which requires both a network
1452 # connection and payment.
1453 aws = dontCheck super.aws;
1454
1455 # Test case tries to contact the network
1456 http-api-data-qq = overrideCabal (drv: {
1457 testFlags = [
1458 "-p"
1459 "!/Can be used with http-client/"
1460 ]
1461 ++ drv.testFlags or [ ];
1462 }) super.http-api-data-qq;
1463
1464 # Test have become more fussy in >= 2.0. We need to have which available for
1465 # tests to succeed and the makefile no longer finds happy by itself.
1466 inherit
1467 (lib.mapAttrs
1468 (
1469 _:
1470 overrideCabal (drv: {
1471 buildTools = drv.buildTools or [ ] ++ [ pkgs.buildPackages.which ];
1472 preCheck = drv.preCheck or "" + ''
1473 export PATH="$PWD/dist/build/happy:$PATH"
1474 '';
1475 })
1476 )
1477 {
1478 inherit (super) happy;
1479 happy_2_1_5 = super.happy_2_1_5.override {
1480 happy-lib = self.happy-lib_2_1_5;
1481 };
1482 }
1483 )
1484 happy_2_1_5
1485 happy
1486 ;
1487
1488 # Additionally install documentation
1489 jacinda = overrideCabal (drv: {
1490 enableSeparateDocOutput = true;
1491 # Test suite is broken by DOS line endings inserted by Hackage revisions
1492 # https://github.com/vmchale/jacinda/issues/5
1493 postPatch = ''
1494 ${drv.postPatch or ""}
1495 ${pkgs.buildPackages.dos2unix}/bin/dos2unix *.cabal
1496 '';
1497 postInstall = ''
1498 ${drv.postInstall or ""}
1499
1500 docDir="$doc/share/doc/${drv.pname}-${drv.version}"
1501
1502 # man page goes to $out, it's small enough and haskellPackages has no
1503 # support for a man output at the moment and $doc requires downloading
1504 # a full PDF
1505 install -Dm644 man/ja.1 -t "$out/share/man/man1"
1506 # language guide and examples
1507 install -Dm644 doc/guide.pdf -t "$docDir"
1508 install -Dm644 test/examples/*.jac -t "$docDir/examples"
1509 '';
1510 }) super.jacinda;
1511
1512 # Needs network access
1513 pinecone = dontCheck super.pinecone;
1514
1515 # Smoke test can't be executed in sandbox
1516 # https://github.com/georgefst/evdev/issues/25
1517 evdev = overrideCabal (drv: {
1518 testFlags = drv.testFlags or [ ] ++ [
1519 "-p"
1520 "!/Smoke/"
1521 ];
1522 }) super.evdev;
1523
1524 # Tests assume dist-newstyle build directory is present
1525 cabal-hoogle = dontCheck super.cabal-hoogle;
1526
1527 nfc = lib.pipe super.nfc [
1528 enableSeparateBinOutput
1529 (addBuildDepend self.base16-bytestring)
1530 (appendConfigureFlag "-fbuild-examples")
1531 ];
1532
1533 # Wants to execute cabal-install to (re-)build itself
1534 hint = dontCheck super.hint;
1535
1536 # cabal-install switched to build type simple in 3.2.0.0
1537 # as a result, the cabal(1) man page is no longer installed
1538 # automatically. Instead we need to use the `cabal man`
1539 # command which generates the man page on the fly and
1540 # install it to $out/share/man/man1 ourselves in this
1541 # override.
1542 # The commit that introduced this change:
1543 # https://github.com/haskell/cabal/commit/91ac075930c87712eeada4305727a4fa651726e7
1544 # Since cabal-install 3.8, the cabal man (without the raw) command
1545 # uses nroff(1) instead of man(1) for macOS/BSD compatibility. That utility
1546 # is not commonly installed on systems, so we add it to PATH. Closure size
1547 # penalty is about 10MB at the time of writing this (2022-08-20).
1548 cabal-install = overrideCabal (old: {
1549 buildTools = [
1550 pkgs.buildPackages.makeWrapper
1551 ]
1552 ++ old.buildTools or [ ];
1553 postInstall = old.postInstall + ''
1554 mkdir -p "$out/share/man/man1"
1555 "$out/bin/cabal" man --raw > "$out/share/man/man1/cabal.1"
1556
1557 wrapProgram "$out/bin/cabal" \
1558 --prefix PATH : "${pkgs.lib.makeBinPath [ pkgs.groff ]}"
1559 '';
1560 hydraPlatforms = pkgs.lib.platforms.all;
1561 broken = false;
1562 }) super.cabal-install;
1563
1564 tailwind =
1565 addBuildDepend
1566 # Overrides for tailwindcss copied from:
1567 # https://github.com/EmaApps/emanote/blob/master/nix/tailwind.nix
1568 (pkgs.tailwindcss.overrideAttrs (oa: {
1569 plugins = [
1570 pkgs.nodePackages."@tailwindcss/aspect-ratio"
1571 pkgs.nodePackages."@tailwindcss/forms"
1572 pkgs.nodePackages."@tailwindcss/line-clamp"
1573 pkgs.nodePackages."@tailwindcss/typography"
1574 ];
1575 # Added a shim for the `tailwindcss` CLI entry point
1576 nativeBuildInputs = (oa.nativeBuildInputs or [ ]) ++ [ pkgs.buildPackages.makeBinaryWrapper ];
1577 postInstall = (oa.postInstall or "") + ''
1578 nodePath=""
1579 for p in "$out" "${pkgs.nodePackages.postcss}" $plugins; do
1580 nodePath="$nodePath''${nodePath:+:}$p/lib/node_modules"
1581 done
1582 makeWrapper "$out/bin/tailwindcss" "$out/bin/tailwind" --prefix NODE_PATH : "$nodePath"
1583 unset nodePath
1584 '';
1585 }))
1586 super.tailwind;
1587
1588 emanote = addBuildDepend pkgs.stork super.emanote;
1589
1590 keid-render-basic = addBuildTool pkgs.glslang super.keid-render-basic;
1591
1592 # Disable checks to break dependency loop with SCalendar
1593 scalendar = dontCheck super.scalendar;
1594
1595 # Make sure we build xz against nixpkgs' xz package instead of
1596 # Hackage repackaging of the upstream sources.
1597 xz = enableCabalFlag "system-xz" super.xz;
1598 xz-clib = dontDistribute super.xz-clib;
1599 lzma-static = dontDistribute super.lzma-static; # deprecated
1600
1601 halide-haskell = super.halide-haskell.override { Halide = pkgs.halide; };
1602
1603 feedback = self.generateOptparseApplicativeCompletions [ "feedback" ] (
1604 enableSeparateBinOutput super.feedback
1605 );
1606
1607 # Sydtest has a brittle test suite that will only work with the exact
1608 # versions that it ships with.
1609 sydtest = dontCheck super.sydtest;
1610
1611 # Prevent argv limit being exceeded when invoking $CC.
1612 inherit
1613 (lib.mapAttrs (
1614 _:
1615 overrideCabal {
1616 __onlyPropagateKnownPkgConfigModules = true;
1617 }
1618 ) super)
1619 gi-javascriptcore
1620 gi-javascriptcore4
1621 gi-javascriptcore6
1622 gi-webkit2webextension
1623 gi-gtk_4_0_12
1624 gi-gdk_4_0_10
1625 gi-gdk4
1626 gi-gdkx114
1627 gi-gtk4
1628 gi-gtksource5
1629 gi-gsk
1630 gi-adwaita
1631 sdl2-ttf
1632 sdl2
1633 dear-imgui
1634 libremidi
1635 ;
1636
1637 webkit2gtk3-javascriptcore = lib.pipe super.webkit2gtk3-javascriptcore [
1638 (addBuildDepend pkgs.xorg.libXtst)
1639 (addBuildDepend pkgs.lerc)
1640 (overrideCabal { __onlyPropagateKnownPkgConfigModules = true; })
1641 ];
1642
1643 gi-webkit2 = lib.pipe super.gi-webkit2 [
1644 (addBuildDepend pkgs.xorg.libXtst)
1645 (addBuildDepend pkgs.lerc)
1646 (overrideCabal { __onlyPropagateKnownPkgConfigModules = true; })
1647 ];
1648
1649 jsaddle-warp = addTestToolDepends [ pkgs.nodejs ] super.jsaddle-warp;
1650
1651 # Makes the mpi-hs package respect the choice of mpi implementation in Nixpkgs.
1652 # Also adds required test dependencies for checks to pass
1653 mpi-hs =
1654 let
1655 validMpi = [
1656 "openmpi"
1657 "mpich"
1658 "mvapich"
1659 ];
1660 mpiImpl = pkgs.mpi.pname;
1661 disableUnused = with builtins; map disableCabalFlag (filter (n: n != mpiImpl) validMpi);
1662 in
1663 lib.pipe (super.mpi-hs.override { ompi = pkgs.mpi; }) (
1664 [
1665 (addTestToolDepends [
1666 pkgs.openssh
1667 pkgs.mpiCheckPhaseHook
1668 ])
1669 ]
1670 ++ disableUnused
1671 ++ lib.optional (builtins.elem mpiImpl validMpi) (enableCabalFlag mpiImpl)
1672 );
1673 inherit
1674 (lib.mapAttrs (
1675 _:
1676 addTestToolDepends [
1677 pkgs.openssh
1678 pkgs.mpiCheckPhaseHook
1679 ]
1680 ) super)
1681 mpi-hs-store
1682 mpi-hs-cereal
1683 mpi-hs-binary
1684 ;
1685
1686 postgresql-libpq = lib.pipe super.postgresql-libpq [
1687 (x: x.override { postgresql-libpq-configure = null; })
1688 (appendConfigureFlag "-fuse-pkg-config")
1689 (addBuildDepend self.postgresql-libpq-pkgconfig)
1690 ];
1691
1692 postgresql-libpq-configure = overrideCabal (drv: {
1693 librarySystemDepends = (drv.librarySystemDepends or [ ]) ++ [ pkgs.libpq ];
1694 libraryToolDepends = (drv.libraryToolDepends or [ ]) ++ [ pkgs.libpq.pg_config ];
1695 }) super.postgresql-libpq-configure;
1696
1697 postgresql-libpq-pkgconfig = addPkgconfigDepend pkgs.libpq super.postgresql-libpq-pkgconfig;
1698
1699 HDBC-postgresql = overrideCabal (drv: {
1700 libraryToolDepends = (drv.libraryToolDepends or [ ]) ++ [ pkgs.libpq.pg_config ];
1701 }) super.HDBC-postgresql;
1702
1703 # Test failure is related to a GHC implementation detail of primitives and doesn't
1704 # cause actual problems in dependent packages, see https://github.com/lehins/pvar/issues/4
1705 pvar = dontCheck super.pvar;
1706
1707 kmonad = lib.pipe super.kmonad [
1708 enableSeparateBinOutput
1709 (overrideCabal (drv: {
1710 passthru = lib.recursiveUpdate drv.passthru or { } { tests.nixos = pkgs.nixosTests.kmonad; };
1711 }))
1712 ];
1713
1714 xmobar = enableSeparateBinOutput super.xmobar;
1715
1716 # 2024-08-09: Disable some cabal-doctest tests pending further investigation.
1717 inherit
1718 (lib.mapAttrs (
1719 _: doctest:
1720 lib.pipe doctest [
1721 (overrideCabal (drv: {
1722 patches = drv.patches or [ ] ++ [
1723 (pkgs.fetchpatch {
1724 name = "doctest-0.23.0-ghc-9.12.patch";
1725 url = "https://github.com/sol/doctest/commit/77373c5d84cd5e59ea86ec30b9ada874f50fad9e.patch";
1726 sha256 = "07dx99lna17fni1ccbklijx1ckkf2p4kk9wvkwib0ihmra70zpn2";
1727 includes = [ "test/**" ];
1728 })
1729 ];
1730 testFlags = drv.testFlags or [ ] ++ [
1731 # These tests require cabal-install (would cause infinite recursion)
1732 "--skip=/Cabal.Options"
1733 "--skip=/Cabal.Paths/paths"
1734 "--skip=/Cabal.ReplOptions" # >= 0.23
1735 ];
1736 }))
1737 doDistribute
1738 ]
1739 ) { inherit (super) doctest doctest_0_23_0; })
1740 doctest
1741 doctest_0_23_0
1742 ;
1743
1744 # tracked upstream: https://github.com/snapframework/openssl-streams/pull/11
1745 # certificate used only 1024 Bit RSA key and SHA-1, which is not allowed in OpenSSL 3.1+
1746 # security level 2
1747 openssl-streams = appendPatch ./patches/openssl-streams-cert.patch super.openssl-streams;
1748
1749 libtorch-ffi =
1750 appendConfigureFlags
1751 (
1752 [
1753 "--extra-include-dirs=${lib.getDev pkgs.libtorch-bin}/include/torch/csrc/api/include"
1754 ]
1755 ++ (lib.optionals pkgs.config.cudaSupport [
1756 "-f"
1757 "cuda"
1758 ])
1759 )
1760 (
1761 super.libtorch-ffi.override ({
1762 c10 = pkgs.libtorch-bin;
1763 torch = pkgs.libtorch-bin;
1764 torch_cpu = pkgs.libtorch-bin;
1765 })
1766 );
1767
1768 # Upper bounds of text and bytestring too strict: https://github.com/zsedem/haskell-cpython/pull/24
1769 cpython = doJailbreak super.cpython;
1770}