1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
|
# NIX-SPECIFIC OVERRIDES/PATCHES FOR HASKELL PACKAGES
#
# This file contains overrides which are needed because of Nix. For example,
# some packages may need help finding the location of native libraries. In
# general, overrides in this file are (mostly) due to one of the following reasons:
#
# * packages that hard code the location of native libraries, so they need to be patched/
# supplied the patch explicitly
# * passing native libraries that are not detected correctly by cabal2nix
# * test suites that fail due to some features not available in the nix sandbox
# (networking being a common one)
#
# In general, this file should *not* contain overrides that fix build failures that could
# also occur on standard, FHS-compliant non-Nix systems. For example, if tests have a compile
# error, that is a bug in the package, and that failure has nothing to do with Nix.
#
# Common examples which should *not* be a part of this file:
#
# * overriding a specific version of a haskell library because some package fails
# to build with a newer version. Such overrides have nothing to do with Nix itself,
# and they would also be neccessary outside of Nix if you use the same set of
# package versions.
# * disabling tests that fail due to missing files in the tarball or compile errors
# * disabling tests that require too much memory
# * enabling/disabling certain features in packages
#
# If you have an override of this kind, see configuration-common.nix instead.
{ pkgs, haskellLib }:
with haskellLib;
# All of the overrides in this set should look like:
#
# foo = ... something involving super.foo ...
#
# but that means that we add `foo` attribute even if there is no `super.foo`! So if
# you want to use this configuration for a package set that only contains a subset of
# the packages that have overrides defined here, you'll end up with a set that contains
# a bunch of attributes that trigger an evaluation error.
#
# To avoid this, we use `intersectAttrs` here so we never add packages that are not present
# in the parent package set (`super`).
self: super: builtins.intersectAttrs super {
# Apply NixOS-specific patches.
ghc-paths = appendPatch super.ghc-paths ./patches/ghc-paths-nix.patch;
# fix errors caused by hardening flags
epanet-haskell = disableHardening super.epanet-haskell ["format"];
# Link the proper version.
zeromq4-haskell = super.zeromq4-haskell.override { zeromq = pkgs.zeromq4; };
# Use the default version of mysql to build this package (which is actually mariadb).
# test phase requires networking
mysql = dontCheck (super.mysql.override { mysql = pkgs.libmysqlclient; });
# CUDA needs help finding the SDK headers and libraries.
cuda = overrideCabal super.cuda (drv: {
extraLibraries = (drv.extraLibraries or []) ++ [pkgs.linuxPackages.nvidia_x11];
configureFlags = (drv.configureFlags or []) ++ [
"--extra-lib-dirs=${pkgs.cudatoolkit.lib}/lib"
"--extra-include-dirs=${pkgs.cudatoolkit}/include"
];
preConfigure = ''
export CUDA_PATH=${pkgs.cudatoolkit}
'';
});
nvvm = overrideCabal super.nvvm (drv: {
preConfigure = ''
export CUDA_PATH=${pkgs.cudatoolkit}
'';
});
cufft = overrideCabal super.cufft (drv: {
preConfigure = ''
export CUDA_PATH=${pkgs.cudatoolkit}
'';
});
# jni needs help finding libjvm.so because it's in a weird location.
jni = overrideCabal super.jni (drv: {
preConfigure = ''
local libdir=( "${pkgs.jdk}/lib/openjdk/jre/lib/"*"/server" )
configureFlags+=" --extra-lib-dir=''${libdir[0]}"
'';
});
# The package doesn't know about the AL include hierarchy.
# https://github.com/phaazon/al/issues/1
al = appendConfigureFlag super.al "--extra-include-dirs=${pkgs.openal}/include/AL";
# Won't find it's header files without help.
sfml-audio = appendConfigureFlag super.sfml-audio "--extra-include-dirs=${pkgs.openal}/include/AL";
hercules-ci-agent = disableLibraryProfiling super.hercules-ci-agent;
# avoid compiling twice by providing executable as a separate output (with small closure size)
niv = enableSeparateBinOutput super.niv;
ormolu = enableSeparateBinOutput super.ormolu;
ghcid = enableSeparateBinOutput super.ghcid;
# Ensure the necessary frameworks for Darwin.
OpenAL = if pkgs.stdenv.isDarwin
then addExtraLibrary super.OpenAL pkgs.darwin.apple_sdk.frameworks.OpenAL
else super.OpenAL;
# Ensure the necessary frameworks for Darwin.
proteaaudio = if pkgs.stdenv.isDarwin
then addExtraLibrary super.proteaaudio pkgs.darwin.apple_sdk.frameworks.AudioToolbox
else super.proteaaudio;
hzk = overrideCabal super.hzk (drv: {
preConfigure = "sed -i -e /include-dirs/d hzk.cabal";
configureFlags = [ "--extra-include-dirs=${pkgs.zookeeper_mt}/include/zookeeper" ];
});
haskakafka = overrideCabal super.haskakafka (drv: {
preConfigure = "sed -i -e /extra-lib-dirs/d -e /include-dirs/d haskakafka.cabal";
configureFlags = [ "--extra-include-dirs=${pkgs.rdkafka}/include/librdkafka" ];
});
# library has hard coded directories that need to be removed. Reported upstream here https://github.com/haskell-works/hw-kafka-client/issues/32
hw-kafka-client = dontCheck (overrideCabal super.hw-kafka-client (drv: {
preConfigure = "sed -i -e /extra-lib-dirs/d -e /include-dirs/d -e /librdkafka/d hw-kafka-client.cabal";
configureFlags = [ "--extra-include-dirs=${pkgs.rdkafka}/include/librdkafka" ];
}));
# Foreign dependency name clashes with another Haskell package.
libarchive-conduit = super.libarchive-conduit.override { archive = pkgs.libarchive; };
# Fix Darwin build.
halive = if pkgs.stdenv.isDarwin
then addBuildDepend super.halive pkgs.darwin.apple_sdk.frameworks.AppKit
else super.halive;
# Heist's test suite requires system pandoc
heist = overrideCabal super.heist (drv: {
testToolDepends = [pkgs.pandoc];
});
# the system-fileio tests use canonicalizePath, which fails in the sandbox
system-fileio = if pkgs.stdenv.isDarwin then dontCheck super.system-fileio else super.system-fileio;
# Prevents needing to add `security_tool` as a run-time dependency for
# everything using x509-system to give access to the `security` executable.
x509-system =
if pkgs.stdenv.hostPlatform.isDarwin && !pkgs.stdenv.cc.nativeLibc
then
# darwin.security_tool is broken in Mojave (#45042)
# We will use the system provided security for now.
# Beware this WILL break in sandboxes!
# TODO(matthewbauer): If someone really needs this to work in sandboxes,
# I think we can add a propagatedImpureHost dep here, but I’m hoping to
# get a proper fix available soonish.
overrideCabal super.x509-system (drv: {
postPatch = (drv.postPatch or "") + ''
substituteInPlace System/X509/MacOS.hs --replace security /usr/bin/security
'';
})
else super.x509-system;
# https://github.com/NixOS/cabal2nix/issues/136 and https://github.com/NixOS/cabal2nix/issues/216
gio = disableHardening (addPkgconfigDepend (addBuildTool super.gio self.buildHaskellPackages.gtk2hs-buildtools) pkgs.glib) ["fortify"];
glib = disableHardening (addPkgconfigDepend (addBuildTool super.glib self.buildHaskellPackages.gtk2hs-buildtools) pkgs.glib) ["fortify"];
gtk3 = disableHardening (super.gtk3.override { inherit (pkgs) gtk3; }) ["fortify"];
gtk = let gtk1 = addBuildTool super.gtk self.buildHaskellPackages.gtk2hs-buildtools;
gtk2 = addPkgconfigDepend gtk1 pkgs.gtk2;
gtk3 = disableHardening gtk1 ["fortify"];
gtk4 = if pkgs.stdenv.isDarwin then appendConfigureFlag gtk3 "-fhave-quartz-gtk" else gtk4;
in gtk3;
gtksourceview2 = addPkgconfigDepend super.gtksourceview2 pkgs.gtk2;
gtk-traymanager = addPkgconfigDepend super.gtk-traymanager pkgs.gtk3;
# Add necessary reference to gtk3 package
gi-dbusmenugtk3 = addPkgconfigDepend super.gi-dbusmenugtk3 pkgs.gtk3;
# Need WebkitGTK, not just webkit.
webkit = super.webkit.override { webkit = pkgs.webkitgtk24x-gtk2; };
websnap = super.websnap.override { webkit = pkgs.webkitgtk24x-gtk3; };
hs-mesos = overrideCabal super.hs-mesos (drv: {
# Pass _only_ mesos; the correct protobuf is propagated.
extraLibraries = [ pkgs.mesos ];
preConfigure = "sed -i -e /extra-lib-dirs/d -e 's|, /usr/include, /usr/local/include/mesos||' hs-mesos.cabal";
});
# These packages try to access the network.
amqp = dontCheck super.amqp;
amqp-conduit = dontCheck super.amqp-conduit;
bitcoin-api = dontCheck super.bitcoin-api;
bitcoin-api-extra = dontCheck super.bitcoin-api-extra;
bitx-bitcoin = dontCheck super.bitx-bitcoin; # http://hydra.cryp.to/build/926187/log/raw
concurrent-dns-cache = dontCheck super.concurrent-dns-cache;
digitalocean-kzs = dontCheck super.digitalocean-kzs; # https://github.com/KazumaSATO/digitalocean-kzs/issues/1
github-types = dontCheck super.github-types; # http://hydra.cryp.to/build/1114046/nixlog/1/raw
hadoop-rpc = dontCheck super.hadoop-rpc; # http://hydra.cryp.to/build/527461/nixlog/2/raw
hasql = dontCheck super.hasql; # http://hydra.cryp.to/build/502489/nixlog/4/raw
hasql-transaction = dontCheck super.hasql-transaction; # wants to connect to postgresql
hjsonschema = overrideCabal super.hjsonschema (drv: { testTarget = "local"; });
marmalade-upload = dontCheck super.marmalade-upload; # http://hydra.cryp.to/build/501904/nixlog/1/raw
mongoDB = dontCheck super.mongoDB;
network-transport-tcp = dontCheck super.network-transport-tcp;
network-transport-zeromq = dontCheck super.network-transport-zeromq; # https://github.com/tweag/network-transport-zeromq/issues/30
pipes-mongodb = dontCheck super.pipes-mongodb; # http://hydra.cryp.to/build/926195/log/raw
pixiv = dontCheck super.pixiv;
raven-haskell = dontCheck super.raven-haskell; # http://hydra.cryp.to/build/502053/log/raw
riak = dontCheck super.riak; # http://hydra.cryp.to/build/498763/log/raw
scotty-binding-play = dontCheck super.scotty-binding-play;
servant-router = dontCheck super.servant-router;
serversession-backend-redis = dontCheck super.serversession-backend-redis;
slack-api = dontCheck super.slack-api; # https://github.com/mpickering/slack-api/issues/5
socket = dontCheck super.socket;
stackage = dontCheck super.stackage; # http://hydra.cryp.to/build/501867/nixlog/1/raw
textocat-api = dontCheck super.textocat-api; # http://hydra.cryp.to/build/887011/log/raw
warp = dontCheck super.warp; # http://hydra.cryp.to/build/501073/nixlog/5/raw
wreq = dontCheck super.wreq; # http://hydra.cryp.to/build/501895/nixlog/1/raw
wreq-sb = dontCheck super.wreq-sb; # http://hydra.cryp.to/build/783948/log/raw
wuss = dontCheck super.wuss; # http://hydra.cryp.to/build/875964/nixlog/2/raw
download = dontCheck super.download;
http-client = dontCheck super.http-client;
http-client-openssl = dontCheck super.http-client-openssl;
http-client-tls = dontCheck super.http-client-tls;
http-conduit = dontCheck super.http-conduit;
transient-universe = dontCheck super.transient-universe;
telegraph = dontCheck super.telegraph;
typed-process = dontCheck super.typed-process;
js-jquery = dontCheck super.js-jquery;
hPDB-examples = dontCheck super.hPDB-examples;
configuration-tools = dontCheck super.configuration-tools; # https://github.com/alephcloud/hs-configuration-tools/issues/40
tcp-streams = dontCheck super.tcp-streams;
holy-project = dontCheck super.holy-project;
mustache = dontCheck super.mustache;
# Tries to mess with extended POSIX attributes, but can't in our chroot environment.
xattr = dontCheck super.xattr;
# Needs access to locale data, but looks for it in the wrong place.
scholdoc-citeproc = dontCheck super.scholdoc-citeproc;
# Disable tests because they require a mattermost server
mattermost-api = dontCheck super.mattermost-api;
# Expect to find sendmail(1) in $PATH.
mime-mail = appendConfigureFlag super.mime-mail "--ghc-option=-DMIME_MAIL_SENDMAIL_PATH=\"sendmail\"";
# Help the test suite find system timezone data.
tz = overrideCabal super.tz (drv: { preConfigure = "export TZDIR=${pkgs.tzdata}/share/zoneinfo"; });
# Nix-specific workaround
xmonad = appendPatch (dontCheck super.xmonad) ./patches/xmonad-nix.patch;
# wxc supports wxGTX >= 3.0, but our current default version points to 2.8.
# http://hydra.cryp.to/build/1331287/log/raw
wxc = (addBuildDepend super.wxc self.split).override { wxGTK = pkgs.wxGTK30; };
wxcore = super.wxcore.override { wxGTK = pkgs.wxGTK30; };
# Test suite wants to connect to $DISPLAY.
hsqml = dontCheck (addExtraLibraries (super.hsqml.override { qt5 = pkgs.qt5Full; }) [pkgs.libGLU pkgs.libGL]);
# Tests attempt to use NPM to install from the network into
# /homeless-shelter. Disabled.
purescript = dontCheck super.purescript;
# https://github.com/haskell-foundation/foundation/pull/412
foundation =
if pkgs.stdenv.isDarwin
then dontCheck super.foundation
else super.foundation;
# Hardcoded include path
poppler = overrideCabal super.poppler (drv: {
postPatch = ''
sed -i -e 's,glib/poppler.h,poppler.h,' poppler.cabal
sed -i -e 's,glib/poppler.h,poppler.h,' Graphics/UI/Gtk/Poppler/Structs.hsc
'';
});
# Uses OpenGL in testing
caramia = dontCheck super.caramia;
llvm-hs =
let llvmHsWithLlvm9 = super.llvm-hs.override { llvm-config = pkgs.llvm_9; };
in
if pkgs.stdenv.isDarwin
then
overrideCabal llvmHsWithLlvm9 (oldAttrs: {
# One test fails on darwin.
doCheck = false;
# llvm-hs's Setup.hs file tries to add the lib/ directory from LLVM8 to
# the DYLD_LIBRARY_PATH environment variable. This messes up clang
# when called from GHC, probably because clang is version 7, but we are
# using LLVM8.
preCompileBuildDriver = oldAttrs.preCompileBuildDriver or "" + ''
substituteInPlace Setup.hs --replace "addToLdLibraryPath libDir" "pure ()"
'';
})
else llvmHsWithLlvm9;
# Needs help finding LLVM.
spaceprobe = addBuildTool super.spaceprobe self.llvmPackages.llvm;
# Tries to run GUI in tests
leksah = dontCheck (overrideCabal super.leksah (drv: {
executableSystemDepends = (drv.executableSystemDepends or []) ++ (with pkgs; [
gnome.adwaita-icon-theme # Fix error: Icon 'window-close' not present in theme ...
wrapGAppsHook # Fix error: GLib-GIO-ERROR **: No GSettings schemas are installed on the system
gtk3 # Fix error: GLib-GIO-ERROR **: Settings schema 'org.gtk.Settings.FileChooser' is not installed
]);
postPatch = (drv.postPatch or "") + ''
for f in src/IDE/Leksah.hs src/IDE/Utils/ServerConnection.hs
do
substituteInPlace "$f" --replace "\"leksah-server\"" "\"${self.leksah-server}/bin/leksah-server\""
done
'';
}));
# Patch to consider NIX_GHC just like xmonad does
dyre = appendPatch super.dyre ./patches/dyre-nix.patch;
yesod-bin = if pkgs.stdenv.isDarwin
then addBuildDepend super.yesod-bin pkgs.darwin.apple_sdk.frameworks.Cocoa
else super.yesod-bin;
hmatrix = if pkgs.stdenv.isDarwin
then addBuildDepend super.hmatrix pkgs.darwin.apple_sdk.frameworks.Accelerate
else super.hmatrix;
# https://github.com/edwinb/EpiVM/issues/13
# https://github.com/edwinb/EpiVM/issues/14
epic = addExtraLibraries (addBuildTool super.epic self.buildHaskellPackages.happy) [pkgs.boehmgc pkgs.gmp];
# https://github.com/ekmett/wl-pprint-terminfo/issues/7
wl-pprint-terminfo = addExtraLibrary super.wl-pprint-terminfo pkgs.ncurses;
# https://github.com/bos/pcap/issues/5
pcap = addExtraLibrary super.pcap pkgs.libpcap;
# https://github.com/NixOS/nixpkgs/issues/53336
greenclip = addExtraLibrary super.greenclip pkgs.xorg.libXdmcp;
# The cabal files for these libraries do not list the required system dependencies.
miniball = overrideCabal super.miniball (drv: {
librarySystemDepends = [ pkgs.miniball ];
});
SDL-image = overrideCabal super.SDL-image (drv: {
librarySystemDepends = [ pkgs.SDL pkgs.SDL_image ] ++ drv.librarySystemDepends or [];
});
SDL-ttf = overrideCabal super.SDL-ttf (drv: {
librarySystemDepends = [ pkgs.SDL pkgs.SDL_ttf ];
});
SDL-mixer = overrideCabal super.SDL-mixer (drv: {
librarySystemDepends = [ pkgs.SDL pkgs.SDL_mixer ];
});
SDL-gfx = overrideCabal super.SDL-gfx (drv: {
librarySystemDepends = [ pkgs.SDL pkgs.SDL_gfx ];
});
SDL-mpeg = overrideCabal super.SDL-mpeg (drv: {
configureFlags = (drv.configureFlags or []) ++ [
"--extra-lib-dirs=${pkgs.smpeg}/lib"
"--extra-include-dirs=${pkgs.smpeg}/include/smpeg"
];
});
# https://github.com/ivanperez-keera/hcwiid/pull/4
hcwiid = overrideCabal super.hcwiid (drv: {
configureFlags = (drv.configureFlags or []) ++ [
"--extra-lib-dirs=${pkgs.bluez.out}/lib"
"--extra-lib-dirs=${pkgs.cwiid}/lib"
"--extra-include-dirs=${pkgs.cwiid}/include"
"--extra-include-dirs=${pkgs.bluez.dev}/include"
];
prePatch = '' sed -i -e "/Extra-Lib-Dirs/d" -e "/Include-Dirs/d" "hcwiid.cabal" '';
});
# cabal2nix doesn't pick up some of the dependencies.
ginsu = let
g = addBuildDepend super.ginsu pkgs.perl;
g' = overrideCabal g (drv: {
executableSystemDepends = (drv.executableSystemDepends or []) ++ [
pkgs.ncurses
];
});
in g';
# Tests require `docker` command in PATH
# Tests require running docker service :on localhost
docker = dontCheck super.docker;
# https://github.com/deech/fltkhs/issues/16
fltkhs = overrideCabal super.fltkhs (drv: {
libraryToolDepends = (drv.libraryToolDepends or []) ++ [pkgs.autoconf];
librarySystemDepends = (drv.librarySystemDepends or []) ++ [pkgs.fltk13 pkgs.libGL pkgs.libjpeg];
});
# https://github.com/skogsbaer/hscurses/pull/26
hscurses = overrideCabal super.hscurses (drv: {
librarySystemDepends = (drv.librarySystemDepends or []) ++ [ pkgs.ncurses ];
});
# Looks like Avahi provides the missing library
dnssd = super.dnssd.override { dns_sd = pkgs.avahi.override { withLibdnssdCompat = true; }; };
# Ensure the necessary frameworks are propagatedBuildInputs on darwin
OpenGLRaw = overrideCabal super.OpenGLRaw (drv: {
librarySystemDepends =
pkgs.lib.optionals (!pkgs.stdenv.isDarwin) drv.librarySystemDepends;
libraryHaskellDepends = drv.libraryHaskellDepends
++ pkgs.lib.optionals pkgs.stdenv.isDarwin
[ pkgs.darwin.apple_sdk.frameworks.OpenGL ];
preConfigure = pkgs.lib.optionalString pkgs.stdenv.isDarwin ''
frameworkPaths=($(for i in $nativeBuildInputs; do if [ -d "$i"/Library/Frameworks ]; then echo "-F$i/Library/Frameworks"; fi done))
frameworkPaths=$(IFS=, ; echo "''${frameworkPaths[@]}")
configureFlags+=$(if [ -n "$frameworkPaths" ]; then echo -n "--ghc-options=-optl=$frameworkPaths"; fi)
'';
});
GLURaw = overrideCabal super.GLURaw (drv: {
librarySystemDepends =
pkgs.lib.optionals (!pkgs.stdenv.isDarwin) drv.librarySystemDepends;
libraryHaskellDepends = drv.libraryHaskellDepends
++ pkgs.lib.optionals pkgs.stdenv.isDarwin
[ pkgs.darwin.apple_sdk.frameworks.OpenGL ];
});
bindings-GLFW = overrideCabal super.bindings-GLFW (drv: {
doCheck = false; # requires an active X11 display
librarySystemDepends =
pkgs.lib.optionals (!pkgs.stdenv.isDarwin) drv.librarySystemDepends;
libraryHaskellDepends = drv.libraryHaskellDepends
++ pkgs.lib.optionals pkgs.stdenv.isDarwin
(with pkgs.darwin.apple_sdk.frameworks;
[ AGL Cocoa OpenGL IOKit Kernel CoreVideo
pkgs.darwin.CF ]);
});
OpenCL = overrideCabal super.OpenCL (drv: {
librarySystemDepends =
pkgs.lib.optionals (!pkgs.stdenv.isDarwin) drv.librarySystemDepends;
libraryHaskellDepends = drv.libraryHaskellDepends
++ pkgs.lib.optionals pkgs.stdenv.isDarwin
[ pkgs.darwin.apple_sdk.frameworks.OpenCL ];
});
# requires an X11 display in test suite
gi-gtk-declarative = dontCheck super.gi-gtk-declarative;
gi-gtk-declarative-app-simple = dontCheck super.gi-gtk-declarative-app-simple;
# tests depend on executable
ghcide = overrideCabal super.ghcide (drv: {
preCheck = ''export PATH="$PWD/dist/build/ghcide:$PATH"'';
});
# GLUT uses `dlopen` to link to freeglut, so we need to set the RUNPATH correctly for
# it to find `libglut.so` from the nix store. We do this by patching GLUT.cabal to pkg-config
# depend on freeglut, which provides GHC to necessary information to generate a correct RPATH.
#
# Note: Simply patching the dynamic library (.so) of the GLUT build will *not* work, since the
# RPATH also needs to be propagated when using static linking. GHC automatically handles this for
# us when we patch the cabal file (Link options will be recored in the ghc package registry).
#
# Additional note: nixpkgs' freeglut and macOS's OpenGL implementation do not cooperate,
# so disable this on Darwin only
${if pkgs.stdenv.isDarwin then null else "GLUT"} = addPkgconfigDepend (appendPatch super.GLUT ./patches/GLUT.patch) pkgs.freeglut;
libsystemd-journal = overrideCabal super.libsystemd-journal (old: {
librarySystemDepends = old.librarySystemDepends or [] ++ [ pkgs.systemd ];
});
# does not specify tests in cabal file, instead has custom runTest cabal hook,
# so cabal2nix will not detect test dependencies.
either-unwrap = overrideCabal super.either-unwrap (drv: {
testHaskellDepends = (drv.testHaskellDepends or []) ++ [ self.test-framework self.test-framework-hunit ];
});
# cabal2nix likes to generate dependencies on hinotify when hfsevents is really required
# on darwin: https://github.com/NixOS/cabal2nix/issues/146.
hinotify = if pkgs.stdenv.isDarwin then self.hfsevents else super.hinotify;
# FSEvents API is very buggy and tests are unreliable. See
# http://openradar.appspot.com/10207999 and similar issues.
# https://github.com/haskell-fswatch/hfsnotify/issues/62
fsnotify = if pkgs.stdenv.isDarwin
then addBuildDepend (dontCheck super.fsnotify) pkgs.darwin.apple_sdk.frameworks.Cocoa
else dontCheck super.fsnotify;
hidapi = addExtraLibrary super.hidapi pkgs.udev;
hs-GeoIP = super.hs-GeoIP.override { GeoIP = pkgs.geoipWithDatabase; };
discount = super.discount.override { markdown = pkgs.discount; };
# tests require working stack installation with all-cabal-hashes cloned in $HOME
stackage-curator = dontCheck super.stackage-curator;
# hardcodes /usr/bin/tr: https://github.com/snapframework/io-streams/pull/59
io-streams = enableCabalFlag super.io-streams "NoInteractiveTests";
# requires autotools to build
secp256k1 = addBuildTools super.secp256k1 [ pkgs.buildPackages.autoconf pkgs.buildPackages.automake pkgs.buildPackages.libtool ];
# requires libsecp256k1 in pkg-config-depends
secp256k1-haskell = addPkgconfigDepend super.secp256k1-haskell pkgs.secp256k1;
# tests require git and zsh
hapistrano = addBuildTools super.hapistrano [ pkgs.buildPackages.git pkgs.buildPackages.zsh ];
# This propagates this to everything depending on haskell-gi-base
haskell-gi-base = addBuildDepend super.haskell-gi-base pkgs.gobject-introspection;
# requires valid, writeable $HOME
hatex-guide = overrideCabal super.hatex-guide (drv: {
preConfigure = ''
${drv.preConfigure or ""}
export HOME=$PWD
'';
});
# https://github.com/plow-technologies/servant-streaming/issues/12
servant-streaming-server = dontCheck super.servant-streaming-server;
# https://github.com/haskell-servant/servant/pull/1238
servant-client-core = if (pkgs.lib.getVersion super.servant-client-core) == "0.16" then
appendPatch super.servant-client-core ./patches/servant-client-core-redact-auth-header.patch
else
super.servant-client-core;
# tests run executable, relying on PATH
# without this, tests fail with "Couldn't launch intero process"
intero = overrideCabal super.intero (drv: {
preCheck = ''
export PATH="$PWD/dist/build/intero:$PATH"
'';
});
# Break infinite recursion cycle with criterion and network-uri.
js-flot = dontCheck super.js-flot;
# Break infinite recursion cycle between QuickCheck and splitmix.
splitmix = dontCheck super.splitmix;
# Break infinite recursion cycle between tasty and clock.
clock = dontCheck super.clock;
# Break infinite recursion cycle between devtools and mprelude.
devtools = super.devtools.override { mprelude = dontCheck super.mprelude; };
# Break dependency cycle between tasty-hedgehog and tasty-expected-failure
tasty-hedgehog = dontCheck super.tasty-hedgehog;
# Break dependency cycle between hedgehog, tasty-hedgehog and lifted-async
lifted-async = dontCheck super.lifted-async;
# loc and loc-test depend on each other for testing. Break that infinite cycle:
loc-test = super.loc-test.override { loc = dontCheck self.loc; };
# The test suites try to run the "fixpoint" and "liquid" executables built just
# before and fail because the library search paths aren't configured properly.
# Also needs https://github.com/ucsd-progsys/liquidhaskell/issues/1038 resolved.
liquid-fixpoint = disableSharedExecutables super.liquid-fixpoint;
liquidhaskell = dontCheck (disableSharedExecutables super.liquidhaskell);
# Without this override, the builds lacks pkg-config.
opencv-extra = addPkgconfigDepend super.opencv-extra pkgs.opencv3;
# Break cyclic reference that results in an infinite recursion.
partial-semigroup = dontCheck super.partial-semigroup;
colour = dontCheck super.colour;
spatial-rotations = dontCheck super.spatial-rotations;
LDAP = dontCheck (overrideCabal super.LDAP (drv: {
librarySystemDepends = drv.librarySystemDepends or [] ++ [ pkgs.cyrus_sasl.dev ];
}));
# Expects z3 to be on path so we replace it with a hard
#
# The tests expect additional solvers on the path, replace the
# available ones also with hard coded paths, and remove the missing
# ones from the test.
sbv = overrideCabal super.sbv (drv: {
postPatch = ''
sed -i -e 's|"abc"|"${pkgs.abc-verifier}/bin/abc"|' Data/SBV/Provers/ABC.hs
sed -i -e 's|"boolector"|"${pkgs.boolector}/bin/boolector"|' Data/SBV/Provers/Boolector.hs
sed -i -e 's|"cvc4"|"${pkgs.cvc4}/bin/cvc4"|' Data/SBV/Provers/CVC4.hs
sed -i -e 's|"yices-smt2"|"${pkgs.yices}/bin/yices-smt2"|' Data/SBV/Provers/Yices.hs
sed -i -e 's|"z3"|"${pkgs.z3}/bin/z3"|' Data/SBV/Provers/Z3.hs
sed -i -e 's|\[abc, boolector, cvc4, mathSAT, yices, z3, dReal\]|[abc, boolector, cvc4, yices, z3]|' SBVTestSuite/SBVConnectionTest.hs
'';
});
# The test-suite requires a running PostgreSQL server.
Frames-beam = dontCheck super.Frames-beam;
# Compile manpages (which are in RST and are compiled with Sphinx).
futhark = with pkgs;
overrideCabal (addBuildTools super.futhark [makeWrapper python37Packages.sphinx])
(_drv: {
postBuild = (_drv.postBuild or "") + ''
make -C docs man
'';
postInstall = (_drv.postInstall or "") + ''
mkdir -p $out/share/man/man1
mv docs/_build/man/*.1 $out/share/man/man1/
'';
});
git-annex = with pkgs;
if (!stdenv.isLinux) then
let path = lib.makeBinPath [ coreutils ];
in overrideCabal (addBuildTool super.git-annex makeWrapper) (_drv: {
# This is an instance of https://github.com/NixOS/nix/pull/1085
# Fails with:
# gpg: can't connect to the agent: File name too long
postPatch = lib.optionalString stdenv.isDarwin ''
substituteInPlace Test.hs \
--replace ', testCase "crypto" test_crypto' ""
'';
# On Darwin, git-annex mis-detects options to `cp`, so we wrap the
# binary to ensure it uses Nixpkgs' coreutils.
postFixup = ''
wrapProgram $out/bin/git-annex \
--prefix PATH : "${path}"
'';
})
else super.git-annex;
# The test suite has undeclared dependencies on git.
githash = dontCheck super.githash;
# Avoid infitite recursion with yaya.
yaya-hedgehog = super.yaya-hedgehog.override { yaya = dontCheck self.yaya; };
# Avoid infitite recursion with tonatona.
tonaparser = dontCheck super.tonaparser;
# Needs internet to run tests
HTTP = dontCheck super.HTTP;
# Break infinite recursions.
Dust-crypto = dontCheck super.Dust-crypto;
nanospec = dontCheck super.nanospec;
options = dontCheck super.options;
snap-server = dontCheck super.snap-server;
# Tests require internet
http-download = dontCheck super.http-download;
pantry = dontCheck super.pantry;
# gtk2hs-buildtools is listed in setupHaskellDepends, but we
# need it during the build itself, too.
cairo = addBuildTool super.cairo self.buildHaskellPackages.gtk2hs-buildtools;
pango = disableHardening (addBuildTool super.pango self.buildHaskellPackages.gtk2hs-buildtools) ["fortify"];
spago =
let
docsSearchApp_0_0_10 = pkgs.fetchurl {
url = "https://github.com/purescript/purescript-docs-search/releases/download/v0.0.10/docs-search-app.js";
sha256 = "0m5ah29x290r0zk19hx2wix2djy7bs4plh9kvjz6bs9r45x25pa5";
};
docsSearchApp_0_0_11 = pkgs.fetchurl {
url = "https://github.com/purescript/purescript-docs-search/releases/download/v0.0.11/docs-search-app.js";
sha256 = "17qngsdxfg96cka1cgrl3zdrpal8ll6vyhhnazqm4hwj16ywjm02";
};
purescriptDocsSearch_0_0_10 = pkgs.fetchurl {
url = "https://github.com/purescript/purescript-docs-search/releases/download/v0.0.10/purescript-docs-search";
sha256 = "0wc1zyhli4m2yykc6i0crm048gyizxh7b81n8xc4yb7ibjqwhyj3";
};
purescriptDocsSearch_0_0_11 = pkgs.fetchurl {
url = "https://github.com/purescript/purescript-docs-search/releases/download/v0.0.11/purescript-docs-search";
sha256 = "1hjdprm990vyxz86fgq14ajn0lkams7i00h8k2i2g1a0hjdwppq6";
};
spagoDocs = overrideCabal super.spago (drv: {
postUnpack = (drv.postUnpack or "") + ''
# Spago includes the following two files directly into the binary
# with Template Haskell. They are fetched at build-time from the
# `purescript-docs-search` repo above. If they cannot be fetched at
# build-time, they are pulled in from the `templates/` directory in
# the spago source.
#
# However, they are not actually available in the spago source, so they
# need to fetched with nix and put in the correct place.
# https://github.com/spacchetti/spago/issues/510
cp ${docsSearchApp_0_0_10} "$sourceRoot/templates/docs-search-app-0.0.10.js"
cp ${docsSearchApp_0_0_11} "$sourceRoot/templates/docs-search-app-0.0.11.js"
cp ${purescriptDocsSearch_0_0_10} "$sourceRoot/templates/purescript-docs-search-0.0.10"
cp ${purescriptDocsSearch_0_0_11} "$sourceRoot/templates/purescript-docs-search-0.0.11"
# For some weird reason, on Darwin, the open(2) call to embed these files
# requires write permissions. The easiest resolution is just to permit that
# (doesn't cause any harm on other systems).
chmod u+w \
"$sourceRoot/templates/docs-search-app-0.0.10.js" \
"$sourceRoot/templates/purescript-docs-search-0.0.10" \
"$sourceRoot/templates/docs-search-app-0.0.11.js" \
"$sourceRoot/templates/purescript-docs-search-0.0.11"
'';
});
# Tests require network access.
spagoWithoutChecks = dontCheck spagoDocs;
in
spagoWithoutChecks;
# checks SQL statements at compile time, and so requires a running PostgreSQL
# database to run it's test suite
postgresql-typed = dontCheck super.postgresql-typed;
# mplayer-spot uses mplayer at runtime.
mplayer-spot =
let path = pkgs.lib.makeBinPath [ pkgs.mplayer ];
in overrideCabal (addBuildTool super.mplayer-spot pkgs.makeWrapper) (oldAttrs: {
postInstall = ''
wrapProgram $out/bin/mplayer-spot --prefix PATH : "${path}"
'';
});
# break infinite recursion with base-orphans
primitive = dontCheck super.primitive;
primitive_0_7_1_0 = dontCheck super.primitive_0_7_1_0;
cut-the-crap =
let path = pkgs.lib.makeBinPath [ pkgs.ffmpeg_3 pkgs.youtube-dl ];
in overrideCabal (addBuildTool super.cut-the-crap pkgs.makeWrapper) (_drv: {
postInstall = ''
wrapProgram $out/bin/cut-the-crap \
--prefix PATH : "${path}"
'';
});
# Tests access homeless-shelter.
hie-bios = dontCheck super.hie-bios;
hie-bios_0_5_0 = dontCheck super.hie-bios_0_5_0;
# Compiling the readme throws errors and has no purpose in nixpkgs
aeson-gadt-th =
disableCabalFlag (doJailbreak (super.aeson-gadt-th)) "build-readme";
neuron = overrideCabal (super.neuron) (drv: {
# neuron expects the neuron-search script to be in PATH at built-time.
buildTools = [ pkgs.makeWrapper ];
preConfigure = ''
mkdir -p $out/bin
cp src-bash/neuron-search $out/bin/neuron-search
chmod +x $out/bin/neuron-search
wrapProgram $out/bin/neuron-search --prefix 'PATH' ':' ${
with pkgs;
lib.makeBinPath [ fzf ripgrep gawk bat findutils envsubst ]
}
PATH=$PATH:$out/bin
'';
});
# Fix compilation of Setup.hs by removing the module declaration.
# See: https://github.com/tippenein/guid/issues/1
guid = overrideCabal (super.guid) (drv: {
prePatch = "sed -i '1d' Setup.hs"; # 1st line is module declaration, remove it
doCheck = false;
});
# Tests disabled as recommended at https://github.com/luke-clifton/shh/issues/39
shh = dontCheck super.shh;
# The test suites fail because there's no PostgreSQL database running in our
# build sandbox.
hasql-queue = dontCheck super.hasql-queue;
postgresql-libpq-notify = dontCheck super.postgresql-libpq-notify;
postgresql-pure = dontCheck super.postgresql-pure;
retrie = overrideCabal super.retrie (drv: {
testToolDepends = [ pkgs.git pkgs.mercurial ];
});
nix-output-monitor = overrideCabal super.nix-output-monitor {
# Can't ran the golden-tests with nix, because they call nix
testTarget = "unit-tests";
};
haskell-language-server = enableCabalFlag (enableCabalFlag (overrideCabal super.haskell-language-server (drv: {
postInstall = let
inherit (pkgs.lib) concatStringsSep take splitString;
ghc_version = self.ghc.version;
ghc_major_version = concatStringsSep "." (take 2 (splitString "." ghc_version));
in ''
ln -s $out/bin/haskell-language-server $out/bin/haskell-language-server-${ghc_version}
ln -s $out/bin/haskell-language-server $out/bin/haskell-language-server-${ghc_major_version}
'';
testToolDepends = [ self.cabal-install pkgs.git ];
testTarget = "func-test"; # wrapper test accesses internet
preCheck = ''
export PATH=$PATH:$PWD/dist/build/haskell-language-server:$PWD/dist/build/haskell-language-server-wrapper
export HOME=$TMPDIR
'';
})) "all-plugins") "all-formatters";
# tests depend on a specific version of solc
hevm = dontCheck (doJailbreak super.hevm);
# hadolint enables static linking by default in the cabal file, so we have to explicitly disable it.
# https://github.com/hadolint/hadolint/commit/e1305042c62d52c2af4d77cdce5d62f6a0a3ce7b
hadolint = disableCabalFlag super.hadolint "static";
# Test suite tries to execute the build product "doctest-driver-gen", but it's not in $PATH.
doctest-driver-gen = dontCheck super.doctest-driver-gen;
# Tests access internet
prune-juice = dontCheck super.prune-juice;
# based on https://github.com/gibiansky/IHaskell/blob/aafeabef786154d81ab7d9d1882bbcd06fc8c6c4/release.nix
ihaskell = overrideCabal super.ihaskell (drv: {
configureFlags = (drv.configureFlags or []) ++ [
# ihaskell's cabal file forces building a shared executable,
# but without passing --enable-executable-dynamic, the RPATH
# contains /build/ and leads to a build failure with nix
"--enable-executable-dynamic"
];
preCheck = ''
export HOME=$TMPDIR/home
export PATH=$PWD/dist/build/ihaskell:$PATH
export GHC_PACKAGE_PATH=$PWD/dist/package.conf.inplace/:$GHC_PACKAGE_PATH
'';
});
# tests need to execute the built executable
stutter = overrideCabal super.stutter (drv: {
preCheck = ''
export PATH=dist/build/stutter:$PATH
'' + (drv.preCheck or "");
});
# Install man page and generate shell completions
pinboard-notes-backup = overrideCabal
(generateOptparseApplicativeCompletion "pnbackup" super.pinboard-notes-backup)
(drv: {
postInstall = ''
install -D man/pnbackup.1 $out/share/man/man1/pnbackup.1
'' + (drv.postInstall or "");
});
FractalArt = overrideCabal super.FractalArt (drv: {
librarySystemDepends = pkgs.lib.optionals pkgs.stdenv.hostPlatform.isDarwin [
pkgs.darwin.libobjc
pkgs.darwin.apple_sdk.frameworks.AppKit
] ++ (drv.librarySystemDepends or []);
});
arbtt = overrideCabal super.arbtt (drv: {
librarySystemDepends = pkgs.lib.optionals pkgs.stdenv.hostPlatform.isDarwin [
pkgs.darwin.apple_sdk.frameworks.Foundation
pkgs.darwin.apple_sdk.frameworks.Carbon
pkgs.darwin.apple_sdk.frameworks.IOKit
] ++ (drv.librarySystemDepends or []);
});
# set more accurate set of platforms instead of maintaining
# an ever growing list of platforms to exclude via unsupported-platforms
cpuid = overrideCabal super.cpuid {
platforms = pkgs.lib.platforms.x86;
};
# Pass the correct libarchive into the package.
streamly-archive = super.streamly-archive.override { archive = pkgs.libarchive; };
}
|