1 # NIX-SPECIFIC OVERRIDES/PATCHES FOR HASKELL PACKAGES
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:
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)
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.
17 # Common examples which should *not* be a part of this file:
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 neccessary outside of Nix if you use the same set of
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
27 # If you have an override of this kind, see configuration-common.nix instead.
36 # All of the overrides in this set should look like:
38 # foo = ... something involving super.foo ...
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.
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 self: super: builtins.intersectAttrs super {
49 # Apply NixOS-specific patches.
50 ghc-paths = appendPatch ./patches/ghc-paths-nix.patch super.ghc-paths;
52 #######################################
53 ### HASKELL-LANGUAGE-SERVER SECTION ###
54 #######################################
56 haskell-language-server = overrideCabal (drv: {
57 # starting with 1.6.1.1 haskell-language-server wants to be linked dynamically
58 # by default. Unless we reflect this in the generic builder, GHC is going to
59 # produce some illegal references to /build/.
60 enableSharedExecutables = true;
61 # The shell script wrapper checks that the runtime ghc and its boot packages match the ghc hls was compiled with.
62 # This prevents linking issues when running TH splices.
64 mv "$out/bin/haskell-language-server" "$out/bin/.haskell-language-server-${self.ghc.version}-unwrapped"
65 BOOT_PKGS="ghc-${self.ghc.version} template-haskell-$(ghc-pkg-${self.ghc.version} --global --simple-output field template-haskell version)"
66 ${pkgs.buildPackages.gnused}/bin/sed \
67 -e "s!@@EXE_DIR@@!$out/bin!" \
68 -e "s/@@EXE_NAME@@/.haskell-language-server-${self.ghc.version}-unwrapped/" \
69 -e "s/@@GHC_VERSION@@/${self.ghc.version}/" \
70 -e "s/@@BOOT_PKGS@@/$BOOT_PKGS/" \
71 -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)/" \
72 -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.!" \
73 bindist/wrapper.in > "$out/bin/haskell-language-server"
74 ln -s "$out/bin/haskell-language-server" "$out/bin/haskell-language-server-${self.ghc.version}"
75 chmod +x "$out/bin/haskell-language-server"
77 testToolDepends = [ self.cabal-install pkgs.git ];
78 testTarget = "func-test"; # wrapper test accesses internet
80 export PATH=$PATH:$PWD/dist/build/haskell-language-server:$PWD/dist/build/haskell-language-server-wrapper
83 }) super.haskell-language-server;
85 # ghcide-bench tests need network
86 ghcide-bench = dontCheck super.ghcide-bench;
88 # 2023-04-01: TODO: Either reenable at least some tests or remove the preCheck override
89 ghcide = overrideCabal (drv: {
90 # tests depend on executable
91 preCheck = ''export PATH="$PWD/dist/build/ghcide:$PATH"'';
92 # tests disabled because they require network
96 hiedb = overrideCabal (drv: {
98 export PATH=$PWD/dist/build/hiedb:$PATH
102 # Tests access homeless-shelter.
103 hie-bios = dontCheck super.hie-bios;
105 ###########################################
106 ### END HASKELL-LANGUAGE-SERVER SECTION ###
107 ###########################################
109 # Test suite needs executable
110 agda2lagda = overrideCabal (drv: {
112 export PATH="$PWD/dist/build/agda2lagda:$PATH"
113 '' + drv.preCheck or "";
116 # - Disable scrypt support since the library used only works on x86 due to SSE2:
117 # https://github.com/informatikr/scrypt/issues/8
118 # - Use crypton as the encryption backend. That override becomes obsolete with
119 # 3.1.* since cabal2nix picks crypton by default then.
122 scryptSupported = pkgs.stdenv.hostPlatform.isx86;
126 (super.password.override ({
127 cryptonite = self.crypton;
128 } // lib.optionalAttrs (!scryptSupported) {
132 (enableCabalFlag "crypton")
133 (disableCabalFlag "cryptonite")
134 # https://github.com/cdepillabout/password/pull/84
135 (appendPatch ./patches/password-3.0.4.0-scrypt-conditional.patch)
136 (overrideCabal (drv: {
137 # patch doesn't apply otherwise because of revisions
138 prePatch = drv.prePatch or "" + ''
139 ${pkgs.buildPackages.dos2unix}/bin/dos2unix *.cabal
142 ] ++ lib.optionals (!scryptSupported) [
143 (disableCabalFlag "scrypt")
146 audacity = enableCabalFlag "buildExamples" (overrideCabal (drv: {
147 executableHaskellDepends = [self.optparse-applicative self.soxlib];
149 # 2023-04-27: Deactivating examples for now because they cause a non-trivial build failure.
150 # med-module = enableCabalFlag "buildExamples" super.med-module;
151 spreadsheet = enableCabalFlag "buildExamples" (overrideCabal (drv: {
152 executableHaskellDepends = [self.optparse-applicative self.shell-utility];
153 }) super.spreadsheet);
155 # fix errors caused by hardening flags
156 epanet-haskell = disableHardening ["format"] super.epanet-haskell;
158 # Link the proper version.
159 zeromq4-haskell = super.zeromq4-haskell.override { zeromq = pkgs.zeromq4; };
161 # cabal2nix incorrectly resolves this to pkgs.zip (could be improved over there).
162 streamly-zip = super.streamly-zip.override { zip = pkgs.libzip; };
164 threadscope = enableSeparateBinOutput super.threadscope;
166 # Use the default version of mysql to build this package (which is actually mariadb).
167 # test phase requires networking
168 mysql = dontCheck super.mysql;
170 # CUDA needs help finding the SDK headers and libraries.
171 cuda = overrideCabal (drv: {
172 extraLibraries = (drv.extraLibraries or []) ++ [pkgs.linuxPackages.nvidia_x11];
173 configureFlags = (drv.configureFlags or []) ++ [
174 "--extra-lib-dirs=${pkgs.cudatoolkit.lib}/lib"
175 "--extra-include-dirs=${pkgs.cudatoolkit}/include"
178 export CUDA_PATH=${pkgs.cudatoolkit}
182 nvvm = overrideCabal (drv: {
184 export CUDA_PATH=${pkgs.cudatoolkit}
188 # Doesn't declare LLVM dependency, needs llvm-config
189 llvm-codegen = addBuildTools [
190 pkgs.llvmPackages_17.llvm.dev # for native llvm-config
191 ] super.llvm-codegen;
196 installHledgerExtraFiles = manpagePathPrefix: overrideCabal (drv: {
197 buildTools = drv.buildTools or [] ++ [
198 pkgs.buildPackages.installShellFiles
201 for i in $(seq 1 9); do
202 installManPage ./${manpagePathPrefix}/*.$i
205 install -v -Dm644 ./${manpagePathPrefix}/*.info* -t "$out/share/info/"
207 if [ -e shell-completion/hledger-completion.bash ]; then
208 installShellCompletion --name hledger shell-completion/hledger-completion.bash
213 hledgerWebTestFix = overrideCabal (drv: {
215 ${drv.preCheck or ""}
216 export HOME="$(mktemp -d)"
221 hledger = installHledgerExtraFiles "" super.hledger;
222 hledger-web = installHledgerExtraFiles "" (hledgerWebTestFix super.hledger-web);
223 hledger-ui = installHledgerExtraFiles "" super.hledger-ui;
225 hledger_1_40 = installHledgerExtraFiles "embeddedfiles"
226 (doDistribute (super.hledger_1_40.override {
227 hledger-lib = self.hledger-lib_1_40;
229 hledger-ui_1_40 = installHledgerExtraFiles ""
230 (doDistribute (super.hledger-ui_1_40.override {
231 hledger = self.hledger_1_40;
232 hledger-lib = self.hledger-lib_1_40;
234 hledger-web_1_40 = installHledgerExtraFiles "" (hledgerWebTestFix
235 (doDistribute (super.hledger-web_1_40.override {
236 hledger = self.hledger_1_40;
237 hledger-lib = self.hledger-lib_1_40;
248 cufft = overrideCabal (drv: {
250 export CUDA_PATH=${pkgs.cudatoolkit}
254 # jni needs help finding libjvm.so because it's in a weird location.
255 jni = overrideCabal (drv: {
257 local libdir=( "${pkgs.jdk}/lib/openjdk/jre/lib/"*"/server" )
258 configureFlags+=" --extra-lib-dir=''${libdir[0]}"
262 # Won't find it's header files without help.
263 sfml-audio = appendConfigureFlag "--extra-include-dirs=${pkgs.openal}/include/AL" super.sfml-audio;
265 # avoid compiling twice by providing executable as a separate output (with small closure size)
266 cabal-fmt = enableSeparateBinOutput super.cabal-fmt;
267 hindent = enableSeparateBinOutput super.hindent;
268 releaser = enableSeparateBinOutput super.releaser;
269 eventlog2html = enableSeparateBinOutput super.eventlog2html;
270 ghc-debug-brick = enableSeparateBinOutput super.ghc-debug-brick;
271 nixfmt = enableSeparateBinOutput super.nixfmt;
272 calligraphy = enableSeparateBinOutput super.calligraphy;
273 niv = overrideCabal (drv: {
274 buildTools = (drv.buildTools or []) ++ [ pkgs.buildPackages.makeWrapper ];
276 wrapProgram ''${!outputBin}/bin/niv --prefix PATH : ${pkgs.lib.makeBinPath [ pkgs.nix ]}
279 (enableSeparateBinOutput (self.generateOptparseApplicativeCompletions [ "niv" ] super.niv));
280 ghcid = enableSeparateBinOutput super.ghcid;
281 ormolu = self.generateOptparseApplicativeCompletions [ "ormolu" ] (enableSeparateBinOutput super.ormolu);
282 hnix = self.generateOptparseApplicativeCompletions [ "hnix" ] super.hnix;
284 # Generate shell completion.
285 cabal2nix = self.generateOptparseApplicativeCompletions [ "cabal2nix" ] super.cabal2nix;
287 arbtt = overrideCabal (drv: {
288 buildTools = drv.buildTools or [] ++ [
289 pkgs.buildPackages.installShellFiles
290 pkgs.buildPackages.libxslt
293 xsl=${pkgs.buildPackages.docbook_xsl}/share/xml/docbook-xsl
294 make -C doc man XSLTPROC_MAN_STYLESHEET=$xsl/manpages/profile-docbook.xsl
297 for f in doc/man/man[1-9]/*; do
301 # The test suite needs the packages's executables in $PATH to succeed.
303 for i in $PWD/dist/build/*; do
304 export PATH="$i:$PATH"
307 # One test uses timezone data
308 testToolDepends = drv.testToolDepends or [] ++ [
313 hzk = appendConfigureFlag "--extra-include-dirs=${pkgs.zookeeper_mt}/include/zookeeper" super.hzk;
315 # Foreign dependency name clashes with another Haskell package.
316 libarchive-conduit = super.libarchive-conduit.override { archive = pkgs.libarchive; };
318 # Heist's test suite requires system pandoc
319 heist = addTestToolDepend pkgs.pandoc super.heist;
321 # Use Nixpkgs' double-conversion library
322 double-conversion = disableCabalFlag "embedded_double_conversion" (
323 addBuildDepends [ pkgs.double-conversion ] super.double-conversion
326 # https://github.com/NixOS/cabal2nix/issues/136 and https://github.com/NixOS/cabal2nix/issues/216
327 gio = lib.pipe super.gio
328 [ (disableHardening ["fortify"])
329 (addBuildTool self.buildHaskellPackages.gtk2hs-buildtools)
331 glib = disableHardening ["fortify"] (addPkgconfigDepend pkgs.glib (addBuildTool self.buildHaskellPackages.gtk2hs-buildtools super.glib));
332 gtk3 = disableHardening ["fortify"] (super.gtk3.override { inherit (pkgs) gtk3; });
333 gtk = lib.pipe super.gtk (
334 [ (disableHardening ["fortify"])
335 (addBuildTool self.buildHaskellPackages.gtk2hs-buildtools)
337 ( if pkgs.stdenv.hostPlatform.isDarwin then [(appendConfigureFlag "-fhave-quartz-gtk")] else [] )
339 gtksourceview2 = addPkgconfigDepend pkgs.gtk2 super.gtksourceview2;
340 gtk-traymanager = addPkgconfigDepend pkgs.gtk3 super.gtk-traymanager;
342 shelly = overrideCabal (drv: {
343 # /usr/bin/env is unavailable in the sandbox
344 preCheck = drv.preCheck or "" + ''
345 chmod +x ./test/data/*.sh
346 patchShebangs --build test/data
350 # Add necessary reference to gtk3 package
351 gi-dbusmenugtk3 = addPkgconfigDepend pkgs.gtk3 super.gi-dbusmenugtk3;
353 # Doesn't declare boost dependency
354 nix-serve-ng = (overrideSrc {
355 version = "1.0.0-unstable-2023-12-18";
356 src = pkgs.fetchFromGitHub {
357 repo = "nix-serve-ng";
358 owner = "aristanetworks";
359 rev = "21e65cb4c62b5c9e3acc11c3c5e8197248fa46a4";
360 hash = "sha256-qseX+/8drgwxOb1I3LKqBYMkmyeI5d5gmHqbZccR660=";
362 } (addPkgconfigDepend pkgs.boost.dev super.nix-serve-ng)).override {
363 nix = pkgs.nixVersions.nix_2_18;
366 # These packages try to access the network.
367 amqp = dontCheck super.amqp;
368 amqp-conduit = dontCheck super.amqp-conduit;
369 bitcoin-api = dontCheck super.bitcoin-api;
370 bitcoin-api-extra = dontCheck super.bitcoin-api-extra;
371 bitx-bitcoin = dontCheck super.bitx-bitcoin; # http://hydra.cryp.to/build/926187/log/raw
372 concurrent-dns-cache = dontCheck super.concurrent-dns-cache;
373 digitalocean-kzs = dontCheck super.digitalocean-kzs; # https://github.com/KazumaSATO/digitalocean-kzs/issues/1
374 github-types = dontCheck super.github-types; # http://hydra.cryp.to/build/1114046/nixlog/1/raw
375 hadoop-rpc = dontCheck super.hadoop-rpc; # http://hydra.cryp.to/build/527461/nixlog/2/raw
376 hjsonschema = overrideCabal (drv: { testTarget = "local"; }) super.hjsonschema;
377 marmalade-upload = dontCheck super.marmalade-upload; # http://hydra.cryp.to/build/501904/nixlog/1/raw
378 mongoDB = dontCheck super.mongoDB;
379 network-transport-tcp = dontCheck super.network-transport-tcp;
380 network-transport-zeromq = dontCheck super.network-transport-zeromq; # https://github.com/tweag/network-transport-zeromq/issues/30
381 oidc-client = dontCheck super.oidc-client; # the spec runs openid against google.com
382 persistent-migration = dontCheck super.persistent-migration; # spec requires pg_ctl binary
383 pipes-mongodb = dontCheck super.pipes-mongodb; # http://hydra.cryp.to/build/926195/log/raw
384 pixiv = dontCheck super.pixiv;
385 raven-haskell = dontCheck super.raven-haskell; # http://hydra.cryp.to/build/502053/log/raw
386 riak = dontCheck super.riak; # http://hydra.cryp.to/build/498763/log/raw
387 scotty-binding-play = dontCheck super.scotty-binding-play;
388 servant-router = dontCheck super.servant-router;
389 serversession-backend-redis = dontCheck super.serversession-backend-redis;
390 slack-api = dontCheck super.slack-api; # https://github.com/mpickering/slack-api/issues/5
391 socket = dontCheck super.socket;
392 stackage = dontCheck super.stackage; # http://hydra.cryp.to/build/501867/nixlog/1/raw
393 textocat-api = dontCheck super.textocat-api; # http://hydra.cryp.to/build/887011/log/raw
394 wreq = dontCheck super.wreq; # http://hydra.cryp.to/build/501895/nixlog/1/raw
395 wreq-sb = dontCheck super.wreq-sb; # http://hydra.cryp.to/build/783948/log/raw
396 wuss = dontCheck super.wuss; # http://hydra.cryp.to/build/875964/nixlog/2/raw
397 download = dontCheck super.download;
398 http-client = dontCheck super.http-client;
399 http-client-openssl = dontCheck super.http-client-openssl;
400 http-client-tls = dontCheck super.http-client-tls;
401 http-conduit = dontCheck super.http-conduit;
402 transient-universe = dontCheck super.transient-universe;
403 telegraph = dontCheck super.telegraph;
404 typed-process = dontCheck super.typed-process;
405 js-jquery = dontCheck super.js-jquery;
406 hPDB-examples = dontCheck super.hPDB-examples;
407 configuration-tools = dontCheck super.configuration-tools; # https://github.com/alephcloud/hs-configuration-tools/issues/40
408 tcp-streams = dontCheck super.tcp-streams;
409 holy-project = dontCheck super.holy-project;
410 mustache = dontCheck super.mustache;
411 arch-web = dontCheck super.arch-web;
413 # Tries accessing the GitHub API
414 github-app-token = dontCheck super.github-app-token;
416 # The curl executable is required for withApplication tests.
417 warp = addTestToolDepend pkgs.curl super.warp;
419 safe-exceptions = overrideCabal (drv: {
420 # Fix strictDeps build error "could not execute: hspec-discover"
421 testToolDepends = drv.testToolDepends or [] ++ [ self.hspec-discover ];
422 }) super.safe-exceptions;
424 # Test suite requires running a database server. Testing is done upstream.
425 hasql = dontCheck super.hasql;
426 hasql-dynamic-statements = dontCheck super.hasql-dynamic-statements;
427 hasql-interpolate = dontCheck super.hasql-interpolate;
428 hasql-notifications = dontCheck super.hasql-notifications;
429 hasql-pool = dontCheck super.hasql-pool;
430 hasql-transaction = dontCheck super.hasql-transaction;
432 # Test suite requires a running postgresql server,
433 # avoid compiling twice by providing executable as a separate output (with small closure size),
434 # generate shell completion
435 postgrest = lib.pipe super.postgrest [
437 enableSeparateBinOutput
438 (self.generateOptparseApplicativeCompletions [ "postgrest" ])
441 # Tries to mess with extended POSIX attributes, but can't in our chroot environment.
442 xattr = dontCheck super.xattr;
444 # Needs access to locale data, but looks for it in the wrong place.
445 scholdoc-citeproc = dontCheck super.scholdoc-citeproc;
447 # Disable tests because they require a mattermost server
448 mattermost-api = dontCheck super.mattermost-api;
450 # Expect to find sendmail(1) in $PATH.
451 mime-mail = appendConfigureFlag "--ghc-option=-DMIME_MAIL_SENDMAIL_PATH=\"sendmail\"" super.mime-mail;
453 # Help the test suite find system timezone data.
454 tz = addBuildDepends [ pkgs.tzdata ] super.tz;
455 tzdata = addBuildDepends [ pkgs.tzdata ] super.tzdata;
457 # https://hydra.nixos.org/build/128665302/nixlog/3
458 # Disable tests because they require a running dbus session
459 xmonad-dbus = dontCheck super.xmonad-dbus;
461 # wxc supports wxGTX >= 3.0, but our current default version points to 2.8.
462 # http://hydra.cryp.to/build/1331287/log/raw
463 wxc = (addBuildDepend self.split super.wxc).override { wxGTK = pkgs.wxGTK32; };
464 wxcore = super.wxcore.override { wxGTK = pkgs.wxGTK32; };
466 shellify = enableSeparateBinOutput super.shellify;
467 specup = enableSeparateBinOutput super.specup;
469 # Test suite wants to connect to $DISPLAY.
470 bindings-GLFW = dontCheck super.bindings-GLFW;
471 gi-gtk-declarative = dontCheck super.gi-gtk-declarative;
472 gi-gtk-declarative-app-simple = dontCheck super.gi-gtk-declarative-app-simple;
473 hsqml = dontCheck (addExtraLibraries [pkgs.libGLU pkgs.libGL] (super.hsqml.override { qt5 = pkgs.qt5Full; }));
474 monomer = dontCheck super.monomer;
476 # Wants to check against a real DB, Needs freetds
477 odbc = dontCheck (addExtraLibraries [ pkgs.freetds ] super.odbc);
479 # Tests attempt to use NPM to install from the network into
480 # /homeless-shelter. Disabled.
481 purescript = dontCheck super.purescript;
483 # Hardcoded include path
484 poppler = overrideCabal (drv: {
486 sed -i -e 's,glib/poppler.h,poppler.h,' poppler.cabal
487 sed -i -e 's,glib/poppler.h,poppler.h,' Graphics/UI/Gtk/Poppler/Structs.hsc
491 # Uses OpenGL in testing
492 caramia = dontCheck super.caramia;
494 # llvm-ffi needs a specific version of LLVM which we hard code here. Since we
495 # can't use pkg-config (LLVM has no official .pc files), we need to pass the
496 # `dev` and `lib` output in, or Cabal will have trouble finding the library.
497 # Since it looks a bit neater having it in a list, we circumvent the singular
501 pkgs.llvmPackages_16.llvm.lib
502 pkgs.llvmPackages_16.llvm.dev
503 ] (super.llvm-ffi.override { LLVM = null; });
505 # Needs help finding LLVM.
506 spaceprobe = addBuildTool self.buildHaskellPackages.llvmPackages.llvm super.spaceprobe;
508 # Tries to run GUI in tests
509 leksah = dontCheck (overrideCabal (drv: {
510 executableSystemDepends = (drv.executableSystemDepends or []) ++ (with pkgs; [
511 adwaita-icon-theme # Fix error: Icon 'window-close' not present in theme ...
512 wrapGAppsHook3 # Fix error: GLib-GIO-ERROR **: No GSettings schemas are installed on the system
513 gtk3 # Fix error: GLib-GIO-ERROR **: Settings schema 'org.gtk.Settings.FileChooser' is not installed
515 postPatch = (drv.postPatch or "") + ''
516 for f in src/IDE/Leksah.hs src/IDE/Utils/ServerConnection.hs
518 substituteInPlace "$f" --replace "\"leksah-server\"" "\"${self.leksah-server}/bin/leksah-server\""
523 # dyre's tests appear to be trying to directly call GHC.
524 dyre = dontCheck super.dyre;
526 # https://github.com/edwinb/EpiVM/issues/13
527 # https://github.com/edwinb/EpiVM/issues/14
528 epic = addExtraLibraries [pkgs.boehmgc pkgs.gmp] (addBuildTool self.buildHaskellPackages.happy super.epic);
530 # https://github.com/ekmett/wl-pprint-terminfo/issues/7
531 wl-pprint-terminfo = addExtraLibrary pkgs.ncurses super.wl-pprint-terminfo;
533 # https://github.com/bos/pcap/issues/5
534 pcap = addExtraLibrary pkgs.libpcap super.pcap;
536 # https://github.com/NixOS/nixpkgs/issues/53336
537 greenclip = addExtraLibrary pkgs.xorg.libXdmcp super.greenclip;
539 # The cabal files for these libraries do not list the required system dependencies.
540 libjwt-typed = addExtraLibrary pkgs.libjwt super.libjwt-typed;
541 miniball = addExtraLibrary pkgs.miniball super.miniball;
542 SDL-image = addExtraLibrary pkgs.SDL super.SDL-image;
543 SDL-ttf = addExtraLibrary pkgs.SDL super.SDL-ttf;
544 SDL-mixer = addExtraLibrary pkgs.SDL super.SDL-mixer;
545 SDL-gfx = addExtraLibrary pkgs.SDL super.SDL-gfx;
546 SDL-mpeg = appendConfigureFlags [
547 "--extra-lib-dirs=${pkgs.smpeg}/lib"
548 "--extra-include-dirs=${pkgs.smpeg.dev}/include/smpeg"
551 # https://github.com/ivanperez-keera/hcwiid/pull/4
552 hcwiid = overrideCabal (drv: {
553 configureFlags = (drv.configureFlags or []) ++ [
554 "--extra-lib-dirs=${pkgs.bluez.out}/lib"
555 "--extra-lib-dirs=${pkgs.cwiid}/lib"
556 "--extra-include-dirs=${pkgs.cwiid}/include"
557 "--extra-include-dirs=${pkgs.bluez.dev}/include"
559 prePatch = ''sed -i -e "/Extra-Lib-Dirs/d" -e "/Include-Dirs/d" "hcwiid.cabal"'';
562 # cabal2nix doesn't pick up some of the dependencies.
564 g = addBuildDepend pkgs.perl super.ginsu;
565 g' = overrideCabal (drv: {
566 executableSystemDepends = (drv.executableSystemDepends or []) ++ [
572 # Tests require `docker` command in PATH
573 # Tests require running docker service :on localhost
574 docker = dontCheck super.docker;
576 # https://github.com/deech/fltkhs/issues/16
577 fltkhs = overrideCabal (drv: {
578 libraryToolDepends = (drv.libraryToolDepends or []) ++ [pkgs.buildPackages.autoconf];
579 librarySystemDepends = (drv.librarySystemDepends or []) ++ [pkgs.fltk13 pkgs.libGL pkgs.libjpeg];
582 # https://github.com/skogsbaer/hscurses/pull/26
583 hscurses = addExtraLibrary pkgs.ncurses super.hscurses;
585 # Looks like Avahi provides the missing library
586 dnssd = super.dnssd.override { dns_sd = pkgs.avahi.override { withLibdnssdCompat = true; }; };
588 # Tests execute goldplate
589 goldplate = overrideCabal (drv: {
590 preCheck = drv.preCheck or "" + ''
591 export PATH="$PWD/dist/build/goldplate:$PATH"
595 # At least on 1.3.4 version on 32-bit architectures tasty requires
596 # unbounded-delays via .cabal file conditions.
597 tasty = overrideCabal (drv: {
598 libraryHaskellDepends =
599 (drv.libraryHaskellDepends or [])
600 ++ lib.optionals (!(pkgs.stdenv.hostPlatform.isAarch64
601 || pkgs.stdenv.hostPlatform.isx86_64)
602 || (self.ghc.isGhcjs or false)) [
603 self.unbounded-delays
607 tasty-discover = overrideCabal (drv: {
608 # Depends on itself for testing
610 export PATH="$PWD/dist/build/tasty-discover:$PATH"
611 '' + (drv.preBuild or "");
612 }) super.tasty-discover;
614 # GLUT uses `dlopen` to link to freeglut, so we need to set the RUNPATH correctly for
615 # it to find `libglut.so` from the nix store. We do this by patching GLUT.cabal to pkg-config
616 # depend on freeglut, which provides GHC to necessary information to generate a correct RPATH.
618 # Note: Simply patching the dynamic library (.so) of the GLUT build will *not* work, since the
619 # RPATH also needs to be propagated when using static linking. GHC automatically handles this for
620 # us when we patch the cabal file (Link options will be recored in the ghc package registry).
622 # Additional note: nixpkgs' freeglut and macOS's OpenGL implementation do not cooperate,
623 # so disable this on Darwin only
624 ${if pkgs.stdenv.hostPlatform.isDarwin then null else "GLUT"} = overrideCabal (drv: {
625 pkg-configDepends = drv.pkg-configDepends or [] ++ [
628 patches = drv.patches or [] ++ [
631 prePatch = drv.prePatch or "" + ''
632 ${lib.getBin pkgs.buildPackages.dos2unix}/bin/dos2unix *.cabal
636 libsystemd-journal = doJailbreak (addExtraLibrary pkgs.systemd super.libsystemd-journal);
638 # does not specify tests in cabal file, instead has custom runTest cabal hook,
639 # so cabal2nix will not detect test dependencies.
640 either-unwrap = overrideCabal (drv: {
641 testHaskellDepends = (drv.testHaskellDepends or []) ++ [ self.test-framework self.test-framework-hunit ];
642 }) super.either-unwrap;
644 # https://github.com/haskell-fswatch/hfsnotify/issues/62
645 fsnotify = dontCheck super.fsnotify;
647 hs-GeoIP = super.hs-GeoIP.override { GeoIP = pkgs.geoipWithDatabase; };
649 discount = super.discount.override { markdown = pkgs.discount; };
651 # tests require working stack installation with all-cabal-hashes cloned in $HOME
652 stackage-curator = dontCheck super.stackage-curator;
654 stack = self.generateOptparseApplicativeCompletions [ "stack" ] super.stack;
656 # hardcodes /usr/bin/tr: https://github.com/snapframework/io-streams/pull/59
657 io-streams = enableCabalFlag "NoInteractiveTests" super.io-streams;
659 # requires autotools to build
660 secp256k1 = addBuildTools [ pkgs.buildPackages.autoconf pkgs.buildPackages.automake pkgs.buildPackages.libtool ] super.secp256k1;
662 # requires libsecp256k1 in pkg-config-depends
663 secp256k1-haskell = addPkgconfigDepend pkgs.secp256k1 super.secp256k1-haskell;
665 # tests require git and zsh
666 hapistrano = addBuildTools [ pkgs.buildPackages.git pkgs.buildPackages.zsh ] super.hapistrano;
668 # This propagates this to everything depending on haskell-gi-base
669 haskell-gi-base = addBuildDepend pkgs.gobject-introspection super.haskell-gi-base;
671 # requires valid, writeable $HOME
672 hatex-guide = overrideCabal (drv: {
674 ${drv.preConfigure or ""}
677 }) super.hatex-guide;
679 # https://github.com/plow-technologies/servant-streaming/issues/12
680 servant-streaming-server = dontCheck super.servant-streaming-server;
682 # https://github.com/haskell-servant/servant/pull/1238
683 servant-client-core = if (pkgs.lib.getVersion super.servant-client-core) == "0.16" then
684 appendPatch ./patches/servant-client-core-redact-auth-header.patch super.servant-client-core
686 super.servant-client-core;
689 # tests run executable, relying on PATH
690 # without this, tests fail with "Couldn't launch intero process"
691 intero = overrideCabal (drv: {
693 export PATH="$PWD/dist/build/intero:$PATH"
697 # Break infinite recursion cycle with criterion and network-uri.
698 js-flot = dontCheck super.js-flot;
700 # Break infinite recursion cycle between QuickCheck and splitmix.
701 splitmix = dontCheck super.splitmix;
703 # Break infinite recursion cycle with OneTuple and quickcheck-instances.
704 foldable1-classes-compat = dontCheck super.foldable1-classes-compat;
706 # Break infinite recursion cycle between tasty and clock.
707 clock = dontCheck super.clock;
709 # Break infinite recursion cycle between devtools and mprelude.
710 devtools = super.devtools.override { mprelude = dontCheck super.mprelude; };
712 # Break dependency cycle between tasty-hedgehog and tasty-expected-failure
713 tasty-hedgehog = dontCheck super.tasty-hedgehog;
715 # Break dependency cycle between hedgehog, tasty-hedgehog and lifted-async
716 lifted-async = dontCheck super.lifted-async;
718 # loc and loc-test depend on each other for testing. Break that infinite cycle:
719 loc-test = super.loc-test.override { loc = dontCheck self.loc; };
721 # The test suites try to run the "fixpoint" and "liquid" executables built just
722 # before and fail because the library search paths aren't configured properly.
723 # Also needs https://github.com/ucsd-progsys/liquidhaskell/issues/1038 resolved.
724 liquid-fixpoint = disableSharedExecutables super.liquid-fixpoint;
725 liquidhaskell = dontCheck (disableSharedExecutables super.liquidhaskell);
727 # Break cyclic reference that results in an infinite recursion.
728 partial-semigroup = dontCheck super.partial-semigroup;
729 colour = dontCheck super.colour;
730 spatial-rotations = dontCheck super.spatial-rotations;
732 LDAP = dontCheck (overrideCabal (drv: {
733 librarySystemDepends = drv.librarySystemDepends or [] ++ [ pkgs.cyrus_sasl.dev ];
736 # Not running the "example" test because it requires a binary from lsps test
737 # suite which is not part of the output of lsp.
738 lsp-test = overrideCabal (old: { testTarget = "tests func-test"; }) super.lsp-test;
740 # the test suite attempts to run the binaries built in this package
741 # through $PATH but they aren't in $PATH
742 dhall-lsp-server = dontCheck super.dhall-lsp-server;
744 # Expects z3 to be on path so we replace it with a hard
746 # The tests expect additional solvers on the path, replace the
747 # available ones also with hard coded paths, and remove the missing
748 # ones from the test.
749 # TODO(@sternenseemann): package cvc5 and re-enable tests
750 sbv = overrideCabal (drv: {
752 sed -i -e 's|"abc"|"${pkgs.abc-verifier}/bin/abc"|' Data/SBV/Provers/ABC.hs
753 sed -i -e 's|"bitwuzla"|"${pkgs.bitwuzla}/bin/bitwuzla"|' Data/SBV/Provers/Bitwuzla.hs
754 sed -i -e 's|"boolector"|"${pkgs.boolector}/bin/boolector"|' Data/SBV/Provers/Boolector.hs
755 sed -i -e 's|"cvc4"|"${pkgs.cvc4}/bin/cvc4"|' Data/SBV/Provers/CVC4.hs
756 sed -i -e 's|"cvc5"|"${pkgs.cvc5}/bin/cvc5"|' Data/SBV/Provers/CVC5.hs
757 sed -i -e 's|"yices-smt2"|"${pkgs.yices}/bin/yices-smt2"|' Data/SBV/Provers/Yices.hs
758 sed -i -e 's|"z3"|"${pkgs.z3}/bin/z3"|' Data/SBV/Provers/Z3.hs
760 # Solvers we don't provide are removed from tests
761 sed -i -e 's|, mathSAT||' SBVTestSuite/SBVConnectionTest.hs
762 sed -i -e 's|, dReal||' SBVTestSuite/SBVConnectionTest.hs
766 # The test-suite requires a running PostgreSQL server.
767 Frames-beam = dontCheck super.Frames-beam;
769 # Compile manpages (which are in RST and are compiled with Sphinx).
773 postBuild = (_drv.postBuild or "") + ''
777 postInstall = (_drv.postInstall or "") + ''
778 mkdir -p $out/share/man/man1
779 mv docs/_build/man/*.1 $out/share/man/man1/
782 (addBuildTools (with pkgs.buildPackages; [makeWrapper python3Packages.sphinx]) super.futhark);
785 # Executables git-annex needs at runtime. git-annex detects these at configure
786 # time and expects to be able to execute them. This means that cross-compiling
787 # git-annex is not possible and strictDeps must be false (runtimeExecDeps go
788 # into executableSystemDepends/buildInputs).
802 overrideCabal (drv: {
803 executableSystemDepends = runtimeExecDeps;
804 enableSharedExecutables = false;
806 preConfigure = drv.preConfigure or "" + ''
811 # git-annex ships its test suite as part of the final executable instead of
812 # using a Cabal test suite.
816 # Setup PATH for the actual tests
817 ln -sf dist/build/git-annex/git-annex git-annex
818 ln -sf git-annex git-annex-shell
821 echo checkFlags: $checkFlags ''${checkFlagsArray:+"''${checkFlagsArray[@]}"}
823 # Doesn't use Cabal's test mechanism
824 git-annex test $checkFlags ''${checkFlagsArray:+"''${checkFlagsArray[@]}"}
829 # Use default installPhase of pkgs/stdenv/generic/setup.sh. We need to set
830 # the environment variables it uses via the preInstall hook since the Haskell
831 # generic builder doesn't accept them as arguments.
832 preInstall = drv.preInstall or "" + ''
833 installTargets="install"
837 # Prevent Makefile from calling cabal/Setup again
839 # Make Haskell build dependencies available
840 "GHC=${self.buildHaskellPackages.ghc.targetPrefix}ghc -global-package-db -package-db $setupPackageConfDir"
845 # Ensure git-annex uses the exact same coreutils it saw at build-time.
846 # This is especially important on Darwin but also in Linux environments
847 # where non-GNU coreutils are used by default.
849 wrapProgram $out/bin/git-annex \
850 --prefix PATH : "${pkgs.lib.makeBinPath (with pkgs; [ coreutils lsof ])}"
851 '' + (drv.postFixup or "");
853 pkgs.buildPackages.makeWrapper
854 ] ++ (drv.buildTools or []);
856 # Git annex provides a restricted login shell. Setting
857 # passthru.shellPath here allows a user's login shell to be set to
858 # `git-annex-shell` by making `shell = haskellPackages.git-annex`.
859 # https://git-annex.branchable.com/git-annex-shell/
860 passthru.shellPath = "/bin/git-annex-shell";
861 }) (super.git-annex.override {
862 dbus = if pkgs.stdenv.hostPlatform.isLinux then self.dbus else null;
863 fdo-notify = if pkgs.stdenv.hostPlatform.isLinux then self.fdo-notify else null;
864 hinotify = if pkgs.stdenv.hostPlatform.isLinux then self.hinotify else self.fsnotify;
867 # The test suite has undeclared dependencies on git.
868 githash = dontCheck super.githash;
870 # Avoid infitite recursion with yaya.
871 yaya-hedgehog = super.yaya-hedgehog.override { yaya = dontCheck self.yaya; };
873 # Avoid infitite recursion with tonatona.
874 tonaparser = dontCheck super.tonaparser;
876 # Needs internet to run tests
877 HTTP = dontCheck super.HTTP;
879 # Break infinite recursions.
880 Dust-crypto = dontCheck super.Dust-crypto;
881 nanospec = dontCheck super.nanospec;
882 options = dontCheck super.options;
883 snap-server = dontCheck super.snap-server;
885 # Tests require internet
886 http-download = dontCheck super.http-download;
887 http-download_0_2_1_0 = doDistribute (dontCheck super.http-download_0_2_1_0);
888 pantry = dontCheck super.pantry;
889 pantry_0_9_3_1 = dontCheck super.pantry_0_9_3_1;
890 pantry_0_10_0 = dontCheck super.pantry_0_10_0;
892 # gtk2hs-buildtools is listed in setupHaskellDepends, but we
893 # need it during the build itself, too.
894 cairo = addBuildTool self.buildHaskellPackages.gtk2hs-buildtools super.cairo;
895 pango = disableHardening ["fortify"] (addBuildTool self.buildHaskellPackages.gtk2hs-buildtools super.pango);
899 docsSearchApp_0_0_10 = pkgs.fetchurl {
900 url = "https://github.com/purescript/purescript-docs-search/releases/download/v0.0.10/docs-search-app.js";
901 sha256 = "0m5ah29x290r0zk19hx2wix2djy7bs4plh9kvjz6bs9r45x25pa5";
904 docsSearchApp_0_0_11 = pkgs.fetchurl {
905 url = "https://github.com/purescript/purescript-docs-search/releases/download/v0.0.11/docs-search-app.js";
906 sha256 = "17qngsdxfg96cka1cgrl3zdrpal8ll6vyhhnazqm4hwj16ywjm02";
909 purescriptDocsSearch_0_0_10 = pkgs.fetchurl {
910 url = "https://github.com/purescript/purescript-docs-search/releases/download/v0.0.10/purescript-docs-search";
911 sha256 = "0wc1zyhli4m2yykc6i0crm048gyizxh7b81n8xc4yb7ibjqwhyj3";
914 purescriptDocsSearch_0_0_11 = pkgs.fetchurl {
915 url = "https://github.com/purescript/purescript-docs-search/releases/download/v0.0.11/purescript-docs-search";
916 sha256 = "1hjdprm990vyxz86fgq14ajn0lkams7i00h8k2i2g1a0hjdwppq6";
919 lib.pipe (super.spago.override {
920 versions = self.versions_5_0_5;
921 fsnotify = self.fsnotify_0_3_0_1;
923 (overrideCabal (drv: {
924 postUnpack = (drv.postUnpack or "") + ''
925 # Spago includes the following two files directly into the binary
926 # with Template Haskell. They are fetched at build-time from the
927 # `purescript-docs-search` repo above. If they cannot be fetched at
928 # build-time, they are pulled in from the `templates/` directory in
931 # However, they are not actually available in the spago source, so they
932 # need to fetched with nix and put in the correct place.
933 # https://github.com/spacchetti/spago/issues/510
934 cp ${docsSearchApp_0_0_10} "$sourceRoot/templates/docs-search-app-0.0.10.js"
935 cp ${docsSearchApp_0_0_11} "$sourceRoot/templates/docs-search-app-0.0.11.js"
936 cp ${purescriptDocsSearch_0_0_10} "$sourceRoot/templates/purescript-docs-search-0.0.10"
937 cp ${purescriptDocsSearch_0_0_11} "$sourceRoot/templates/purescript-docs-search-0.0.11"
939 # For some weird reason, on Darwin, the open(2) call to embed these files
940 # requires write permissions. The easiest resolution is just to permit that
941 # (doesn't cause any harm on other systems).
943 "$sourceRoot/templates/docs-search-app-0.0.10.js" \
944 "$sourceRoot/templates/purescript-docs-search-0.0.10" \
945 "$sourceRoot/templates/docs-search-app-0.0.11.js" \
946 "$sourceRoot/templates/purescript-docs-search-0.0.11"
950 # Tests require network access.
953 # Overly strict upper bound on text
956 # Generate shell completion for spago
957 (self.generateOptparseApplicativeCompletions [ "spago" ])
960 # checks SQL statements at compile time, and so requires a running PostgreSQL
961 # database to run it's test suite
962 postgresql-typed = dontCheck super.postgresql-typed;
964 # mplayer-spot uses mplayer at runtime.
966 let path = pkgs.lib.makeBinPath [ pkgs.mplayer ];
967 in overrideCabal (oldAttrs: {
969 wrapProgram $out/bin/mplayer-spot --prefix PATH : "${path}"
971 }) (addBuildTool pkgs.buildPackages.makeWrapper super.mplayer-spot);
973 # break infinite recursion with base-orphans
974 primitive = dontCheck super.primitive;
975 primitive_0_7_1_0 = dontCheck super.primitive_0_7_1_0;
978 let path = pkgs.lib.makeBinPath [ pkgs.ffmpeg pkgs.youtube-dl ];
979 in overrideCabal (_drv: {
981 wrapProgram $out/bin/cut-the-crap \
982 --prefix PATH : "${path}"
984 }) (addBuildTool pkgs.buildPackages.makeWrapper super.cut-the-crap);
986 # Compiling the readme throws errors and has no purpose in nixpkgs
988 disableCabalFlag "build-readme" (doJailbreak super.aeson-gadt-th);
990 # Fix compilation of Setup.hs by removing the module declaration.
991 # See: https://github.com/tippenein/guid/issues/1
992 guid = overrideCabal (drv: {
993 prePatch = "sed -i '1d' Setup.hs"; # 1st line is module declaration, remove it
997 # Tests disabled as recommended at https://github.com/luke-clifton/shh/issues/39
998 shh = dontCheck super.shh;
1000 # The test suites fail because there's no PostgreSQL database running in our
1002 hasql-queue = dontCheck super.hasql-queue;
1003 postgresql-libpq-notify = dontCheck super.postgresql-libpq-notify;
1004 postgresql-pure = dontCheck super.postgresql-pure;
1006 retrie = addTestToolDepends [pkgs.git pkgs.mercurial] super.retrie;
1007 retrie_1_2_0_0 = addTestToolDepends [pkgs.git pkgs.mercurial] super.retrie_1_2_0_0;
1008 retrie_1_2_1_1 = addTestToolDepends [pkgs.git pkgs.mercurial] super.retrie_1_2_1_1;
1011 # there are three very heavy test suites that need external repos, one requires network access
1012 hevm = dontCheck super.hevm;
1014 # hadolint enables static linking by default in the cabal file, so we have to explicitly disable it.
1015 # https://github.com/hadolint/hadolint/commit/e1305042c62d52c2af4d77cdce5d62f6a0a3ce7b
1016 hadolint = disableCabalFlag "static" super.hadolint;
1018 # Test suite tries to execute the build product "doctest-driver-gen", but it's not in $PATH.
1019 doctest-driver-gen = dontCheck super.doctest-driver-gen;
1021 # Tests access internet
1022 prune-juice = dontCheck super.prune-juice;
1024 citeproc = lib.pipe super.citeproc [
1025 enableSeparateBinOutput
1026 # Enable executable being built and add missing dependencies
1027 (enableCabalFlag "executable")
1028 (addBuildDepends [ self.aeson-pretty ])
1029 # TODO(@sternenseemann): we may want to enable that for improved performance
1030 # Is correctness good enough since 0.5?
1031 (disableCabalFlag "icu")
1034 # based on https://github.com/gibiansky/IHaskell/blob/aafeabef786154d81ab7d9d1882bbcd06fc8c6c4/release.nix
1035 ihaskell = overrideCabal (drv: {
1036 # ihaskell's cabal file forces building a shared executable, which we need
1037 # to reflect here or RPATH will contain a reference to /build/.
1038 enableSharedExecutables = true;
1040 export HOME=$TMPDIR/home
1041 export PATH=$PWD/dist/build/ihaskell:$PATH
1042 export NIX_GHC_PACKAGE_PATH_FOR_TEST=$PWD/dist/package.conf.inplace/:$packageConfDir:
1046 # tests need to execute the built executable
1047 stutter = overrideCabal (drv: {
1049 export PATH=dist/build/stutter:$PATH
1050 '' + (drv.preCheck or "");
1053 # Install man page and generate shell completions
1054 pinboard-notes-backup = overrideCabal
1057 install -D man/pnbackup.1 $out/share/man/man1/pnbackup.1
1058 '' + (drv.postInstall or "");
1060 (self.generateOptparseApplicativeCompletions [ "pnbackup" ] super.pinboard-notes-backup);
1062 # Pass the correct libarchive into the package.
1063 streamly-archive = super.streamly-archive.override { archive = pkgs.libarchive; };
1065 hlint = overrideCabal (drv: {
1067 install -Dm644 data/hlint.1 -t "$out/share/man/man1"
1068 '' + drv.postInstall or "";
1071 taglib = overrideCabal (drv: {
1072 librarySystemDepends = [
1074 ] ++ (drv.librarySystemDepends or []);
1077 # random 1.2.0 has tests that indirectly depend on
1078 # itself causing an infinite recursion at evaluation
1080 random = dontCheck super.random;
1082 # https://github.com/Gabriella439/nix-diff/pull/74
1083 nix-diff = overrideCabal (drv: {
1085 substituteInPlace src/Nix/Diff/Types.hs \
1086 --replace "{-# OPTIONS_GHC -Wno-orphans #-}" "{-# OPTIONS_GHC -Wno-orphans -fconstraint-solver-iterations=0 #-}"
1088 }) (doJailbreak (dontCheck super.nix-diff));
1090 # mockery's tests depend on hspec-discover which dependso on mockery for its tests
1091 mockery = dontCheck super.mockery;
1092 # same for logging-facade
1093 logging-facade = dontCheck super.logging-facade;
1095 # Since this package is primarily used by nixpkgs maintainers and is probably
1096 # not used to link against by anyone, we can make it’s closure smaller and
1097 # add its runtime dependencies in `haskellPackages` (as opposed to cabal2nix).
1098 cabal2nix-unstable = overrideCabal
1100 buildTools = (drv.buildTools or []) ++ [
1101 pkgs.buildPackages.makeWrapper
1104 ${drv.postInstall or ""}
1106 wrapProgram $out/bin/cabal2nix \
1107 --prefix PATH ":" "${
1108 pkgs.lib.makeBinPath [ pkgs.nix pkgs.nix-prefetch-scripts ]
1112 (justStaticExecutables super.cabal2nix-unstable);
1114 # test suite needs local redis daemon
1115 nri-redis = dontCheck super.nri-redis;
1117 # Make tophat find itself for _compiling_ its test suite
1118 tophat = overrideCabal (drv: {
1120 sed -i 's|"tophat"|"./dist/build/tophat/tophat"|' app-test-bin/*.hs
1121 '' + (drv.postPatch or "");
1124 # Runtime dependencies and CLI completion
1125 nvfetcher = self.generateOptparseApplicativeCompletions [ "nvfetcher" ] (overrideCabal
1127 # test needs network
1129 buildTools = drv.buildTools or [ ] ++ [ pkgs.buildPackages.makeWrapper ];
1130 postInstall = drv.postInstall or "" + ''
1131 wrapProgram "$out/bin/nvfetcher" --prefix 'PATH' ':' "${
1132 pkgs.lib.makeBinPath [
1134 pkgs.nix # nix-prefetch-url
1135 pkgs.nix-prefetch-git
1136 pkgs.nix-prefetch-docker
1140 # Prevent erroneous references to other libraries that use Paths_ modules
1141 # on aarch64-darwin. Note that references to the data outputs are not removed.
1142 + lib.optionalString (with pkgs.stdenv; hostPlatform.isDarwin && hostPlatform.isAarch64) ''
1143 remove-references-to -t "${self.shake.out}" "$out/bin/.nvfetcher-wrapped"
1144 remove-references-to -t "${self.js-jquery.out}" "$out/bin/.nvfetcher-wrapped"
1145 remove-references-to -t "${self.js-flot.out}" "$out/bin/.nvfetcher-wrapped"
1146 remove-references-to -t "${self.js-dgtable.out}" "$out/bin/.nvfetcher-wrapped"
1148 }) super.nvfetcher);
1150 rel8 = pkgs.lib.pipe super.rel8 [
1151 (addTestToolDepend pkgs.postgresql)
1152 # https://github.com/NixOS/nixpkgs/issues/198495
1153 (dontCheckIf (!pkgs.postgresql.doCheck))
1160 # The code-path that generates the optparse-applicative completions uses
1161 # the HOME directory, so that must be set in order to generate completions.
1162 # https://github.com/cdepillabout/cloudy/issues/10
1163 ( overrideCabal (oldAttrs: {
1166 '' + (oldAttrs.postInstall or "");
1169 (self.generateOptparseApplicativeCompletions ["cloudy"])
1172 # Wants running postgresql database accessible over ip, so postgresqlTestHook
1173 # won't work (or would need to patch test suite).
1174 domaindriven-core = dontCheck super.domaindriven-core;
1176 cachix = self.generateOptparseApplicativeCompletions [ "cachix" ]
1177 (enableSeparateBinOutput super.cachix);
1179 hercules-ci-agent = super.hercules-ci-agent.override { nix = self.hercules-ci-cnix-store.passthru.nixPackage; };
1180 hercules-ci-cnix-expr = addTestToolDepend pkgs.git (super.hercules-ci-cnix-expr.override { nix = self.hercules-ci-cnix-store.passthru.nixPackage; });
1181 hercules-ci-cnix-store = overrideCabal
1183 passthru = old.passthru or { } // {
1184 nixPackage = pkgs.nixVersions.nix_2_19;
1187 (super.hercules-ci-cnix-store.override {
1188 nix = self.hercules-ci-cnix-store.passthru.nixPackage;
1191 # the testsuite fails because of not finding tsc without some help
1192 aeson-typescript = overrideCabal (drv: {
1193 testToolDepends = drv.testToolDepends or [] ++ [ pkgs.typescript ];
1194 # the testsuite assumes that tsc is in the PATH if it thinks it's in
1195 # CI, otherwise trying to install it.
1197 # https://github.com/codedownio/aeson-typescript/blob/ee1a87fcab8a548c69e46685ce91465a7462be89/test/Util.hs#L27-L33
1198 preCheck = "export CI=true";
1199 }) super.aeson-typescript;
1201 Agda = lib.pipe super.Agda [
1202 # Enable extra optimisations which increase build time, but also
1203 # later compiler performance, so we should do this for user's benefit.
1204 # Flag added in Agda 2.6.2
1205 (enableCabalFlag "optimise-heavily")
1206 # Enable debug printing, which worsens performance slightly but is
1208 # Flag added in Agda 2.6.4.1, was always enabled before
1209 (enableCabalFlag "debug")
1210 # Split outputs to reduce closure size
1211 enableSeparateBinOutput
1214 # ats-format uses cli-setup in Setup.hs which is quite happy to write
1215 # to arbitrary files in $HOME. This doesn't either not achieve anything
1216 # or even fail, so we prevent it and install everything necessary ourselves.
1217 # See also: https://hackage.haskell.org/package/cli-setup-0.2.1.4/docs/src/Distribution.CommandLine.html#setManpathGeneric
1218 ats-format = self.generateOptparseApplicativeCompletions [ "atsfmt" ] (
1219 justStaticExecutables (
1220 overrideCabal (drv: {
1221 # use vanilla Setup.hs
1222 preCompileBuildDriver = ''
1223 cat > Setup.hs << EOF
1225 import Distribution.Simple
1228 '' + (drv.preCompileBuildDriver or "");
1231 pkgs.buildPackages.installShellFiles
1232 ] ++ (drv.buildTools or []);
1234 installManPage man/atsfmt.1
1235 '' + (drv.postInstall or "");
1240 # Test suite is just the default example executable which doesn't work if not
1241 # executed by Setup.hs, but works if started on a proper TTY
1242 isocline = dontCheck super.isocline;
1244 # Some hash implementations are x86 only, but part of the test suite.
1245 # So executing and building it on non-x86 platforms will always fail.
1246 hashes = dontCheckIf (!pkgs.stdenv.hostPlatform.isx86) super.hashes;
1248 # Tries to access network
1249 aws-sns-verify = dontCheck super.aws-sns-verify;
1251 # Test suite requires network access
1252 minicurl = dontCheck super.minicurl;
1254 # procex relies on close_range which has been introduced in Linux 5.9,
1255 # the test suite seems to force the use of this feature (or the fallback
1256 # mechanism is broken), so we can't run the test suite on machines with a
1257 # Kernel < 5.9. To check for this, we use uname -r to obtain the Kernel
1258 # version and sort -V to compare against our minimum version. If the
1259 # Kernel turns out to be older, we disable the test suite.
1260 procex = overrideCabal (drv: {
1263 higherVersion=`printf "%s\n%s\n" "$minimumKernel" "$(uname -r)" | sort -rV | head -n1`
1264 if [[ "$higherVersion" = "$minimumKernel" ]]; then
1265 echo "Used Kernel doesn't support close_range, disabling tests"
1268 '' + (drv.postConfigure or "");
1271 # Test suite wants to run main executable
1272 # https://github.com/fourmolu/fourmolu/issues/231
1275 fourmoluTestFix = overrideCabal (drv: {
1276 preCheck = drv.preCheck or "" + ''
1277 export PATH="$PWD/dist/build/fourmolu:$PATH"
1281 builtins.mapAttrs (_: fourmoluTestFix) super
1288 # Test suite needs to execute 'disco' binary
1289 disco = overrideCabal (drv: {
1290 preCheck = drv.preCheck or "" + ''
1291 export PATH="$PWD/dist/build/disco:$PATH"
1293 testFlags = drv.testFlags or [] ++ [
1294 # Needs network access
1297 # disco-examples needs network access
1298 testTarget = "disco-tests";
1301 # Apply a patch which hardcodes the store path of graphviz instead of using
1302 # whatever graphviz is in PATH.
1303 graphviz = overrideCabal (drv: {
1305 (pkgs.substituteAll {
1306 src = ./patches/graphviz-hardcode-graphviz-store-path.patch;
1307 inherit (pkgs) graphviz;
1309 ] ++ (drv.patches or []);
1312 # Test suite requires AWS access which requires both a network
1313 # connection and payment.
1314 aws = dontCheck super.aws;
1316 # Test case tries to contact the network
1317 http-api-data-qq = overrideCabal (drv: {
1319 "-p" "!/Can be used with http-client/"
1320 ] ++ drv.testFlags or [];
1321 }) super.http-api-data-qq;
1323 # Additionally install documentation
1324 jacinda = overrideCabal (drv: {
1325 enableSeparateDocOutput = true;
1327 ${drv.postInstall or ""}
1329 docDir="$doc/share/doc/${drv.pname}-${drv.version}"
1331 # man page goes to $out, it's small enough and haskellPackages has no
1332 # support for a man output at the moment and $doc requires downloading
1334 install -Dm644 man/ja.1 -t "$out/share/man/man1"
1335 # language guide and examples
1336 install -Dm644 doc/guide.pdf -t "$docDir"
1337 install -Dm644 test/examples/*.jac -t "$docDir/examples"
1341 # Smoke test can't be executed in sandbox
1342 # https://github.com/georgefst/evdev/issues/25
1343 evdev = overrideCabal (drv: {
1344 testFlags = drv.testFlags or [] ++ [
1349 # Tests assume dist-newstyle build directory is present
1350 cabal-hoogle = dontCheck super.cabal-hoogle;
1352 nfc = lib.pipe super.nfc [
1353 enableSeparateBinOutput
1354 (addBuildDepend self.base16-bytestring)
1355 (appendConfigureFlag "-fbuild-examples")
1358 # Wants to execute cabal-install to (re-)build itself
1359 hint = dontCheck super.hint;
1361 # cabal-install switched to build type simple in 3.2.0.0
1362 # as a result, the cabal(1) man page is no longer installed
1363 # automatically. Instead we need to use the `cabal man`
1364 # command which generates the man page on the fly and
1365 # install it to $out/share/man/man1 ourselves in this
1367 # The commit that introduced this change:
1368 # https://github.com/haskell/cabal/commit/91ac075930c87712eeada4305727a4fa651726e7
1369 # Since cabal-install 3.8, the cabal man (without the raw) command
1370 # uses nroff(1) instead of man(1) for macOS/BSD compatibility. That utility
1371 # is not commonly installed on systems, so we add it to PATH. Closure size
1372 # penalty is about 10MB at the time of writing this (2022-08-20).
1373 cabal-install = overrideCabal (old: {
1374 executableToolDepends = [
1375 pkgs.buildPackages.makeWrapper
1376 ] ++ old.buildToolDepends or [];
1377 postInstall = old.postInstall + ''
1378 mkdir -p "$out/share/man/man1"
1379 "$out/bin/cabal" man --raw > "$out/share/man/man1/cabal.1"
1381 wrapProgram "$out/bin/cabal" \
1382 --prefix PATH : "${pkgs.lib.makeBinPath [ pkgs.groff ]}"
1384 hydraPlatforms = pkgs.lib.platforms.all;
1386 }) super.cabal-install;
1388 tailwind = addBuildDepend
1389 # Overrides for tailwindcss copied from:
1390 # https://github.com/EmaApps/emanote/blob/master/nix/tailwind.nix
1391 (pkgs.nodePackages.tailwindcss.overrideAttrs (oa: {
1393 pkgs.nodePackages."@tailwindcss/aspect-ratio"
1394 pkgs.nodePackages."@tailwindcss/forms"
1395 pkgs.nodePackages."@tailwindcss/line-clamp"
1396 pkgs.nodePackages."@tailwindcss/typography"
1400 emanote = addBuildDepend pkgs.stork super.emanote;
1402 keid-render-basic = addBuildTool pkgs.glslang super.keid-render-basic;
1404 # Disable checks to break dependency loop with SCalendar
1405 scalendar = dontCheck super.scalendar;
1407 halide-haskell = super.halide-haskell.override { Halide = pkgs.halide; };
1409 feedback = self.generateOptparseApplicativeCompletions [ "feedback" ]
1410 (enableSeparateBinOutput super.feedback);
1412 # Sydtest has a brittle test suite that will only work with the exact
1413 # versions that it ships with.
1414 sydtest = dontCheck super.sydtest;
1416 # Prevent argv limit being exceeded when invoking $CC.
1417 inherit (lib.mapAttrs (_: overrideCabal {
1418 __onlyPropagateKnownPkgConfigModules = true;
1421 gi-webkit2webextension
1431 webkit2gtk3-javascriptcore = lib.pipe super.webkit2gtk3-javascriptcore [
1432 (addBuildDepend pkgs.xorg.libXtst)
1433 (addBuildDepend pkgs.lerc)
1434 (overrideCabal { __onlyPropagateKnownPkgConfigModules = true; })
1437 gi-webkit2 = lib.pipe super.gi-webkit2 [
1438 (addBuildDepend pkgs.xorg.libXtst)
1439 (addBuildDepend pkgs.lerc)
1440 (overrideCabal { __onlyPropagateKnownPkgConfigModules = true; })
1443 # Makes the mpi-hs package respect the choice of mpi implementation in Nixpkgs.
1444 # Also adds required test dependencies for checks to pass
1446 let validMpi = [ "openmpi" "mpich" "mvapich" ];
1447 mpiImpl = pkgs.mpi.pname;
1448 disableUnused = with builtins; map disableCabalFlag (filter (n: n != mpiImpl) validMpi);
1450 (super.mpi-hs_0_7_3_1.override { ompi = pkgs.mpi; })
1451 ( [ (addTestToolDepends [ pkgs.openssh pkgs.mpiCheckPhaseHook ]) ]
1453 ++ lib.optional (builtins.elem mpiImpl validMpi) (enableCabalFlag mpiImpl)
1455 inherit (lib.mapAttrs (_: addTestToolDepends
1456 [ pkgs.openssh pkgs.mpiCheckPhaseHook ]
1463 postgresql-libpq = overrideCabal (drv: {
1464 # Using use-pkg-config flag, because pg_config won't work when cross-compiling.
1465 configureFlags = drv.configureFlags or [] ++ [ "-fuse-pkg-config" ];
1466 # Move postgresql from SystemDepends to PkgconfigDepends
1467 libraryPkgconfigDepends = drv.librarySystemDepends;
1468 librarySystemDepends = [];
1469 }) super.postgresql-libpq;
1471 # Test failure is related to a GHC implementation detail of primitives and doesn't
1472 # cause actual problems in dependent packages, see https://github.com/lehins/pvar/issues/4
1473 pvar = dontCheck super.pvar;
1475 kmonad = enableSeparateBinOutput super.kmonad;
1477 xmobar = enableSeparateBinOutput super.xmobar;
1479 # 2024-08-09: Disable some cabal-doctest tests pending further investigation.
1480 doctest = overrideCabal (drv: {
1481 testFlags = drv.testFlags or [] ++ [
1482 # These tests require cabal-install
1483 "--skip=/Cabal.Options"
1484 "--skip=/Cabal.Paths/paths"
1488 # tracked upstream: https://github.com/snapframework/openssl-streams/pull/11
1489 # certificate used only 1024 Bit RSA key and SHA-1, which is not allowed in OpenSSL 3.1+
1491 openssl-streams = appendPatch ./patches/openssl-streams-cert.patch super.openssl-streams;