2021-05-08 17:32:54 +02:00
|
|
|
|
# DARWIN-SPECIFIC OVERRIDES FOR THE HASKELL PACKAGE SET IN NIXPKGS
|
|
|
|
|
|
|
|
|
|
{ pkgs, haskellLib }:
|
|
|
|
|
|
|
|
|
|
let
|
|
|
|
|
inherit (pkgs) lib darwin;
|
|
|
|
|
in
|
|
|
|
|
|
|
|
|
|
with haskellLib;
|
|
|
|
|
|
2021-08-28 14:47:58 +02:00
|
|
|
|
self: super: ({
|
2021-05-08 17:32:54 +02:00
|
|
|
|
|
|
|
|
|
# the tests for shell-conduit on Darwin illegitimatey assume non-GNU echo
|
|
|
|
|
# see: https://github.com/psibi/shell-conduit/issues/12
|
|
|
|
|
shell-conduit = dontCheck super.shell-conduit;
|
|
|
|
|
|
|
|
|
|
conduit-extra = super.conduit-extra.overrideAttrs (drv: {
|
|
|
|
|
__darwinAllowLocalNetworking = true;
|
|
|
|
|
});
|
|
|
|
|
|
2021-10-26 12:20:34 +02:00
|
|
|
|
halive = addBuildDepend darwin.apple_sdk.frameworks.AppKit super.halive;
|
2021-05-08 17:32:54 +02:00
|
|
|
|
|
|
|
|
|
# Hakyll's tests are broken on Darwin (3 failures); and they require util-linux
|
2021-10-26 12:20:34 +02:00
|
|
|
|
hakyll = overrideCabal {
|
2021-05-08 17:32:54 +02:00
|
|
|
|
testToolDepends = [];
|
|
|
|
|
doCheck = false;
|
2021-10-26 12:20:34 +02:00
|
|
|
|
} super.hakyll;
|
2021-05-08 17:32:54 +02:00
|
|
|
|
|
2021-10-26 12:20:34 +02:00
|
|
|
|
barbly = addBuildDepend darwin.apple_sdk.frameworks.AppKit super.barbly;
|
2021-05-08 17:32:54 +02:00
|
|
|
|
|
2021-10-26 12:20:34 +02:00
|
|
|
|
double-conversion = addExtraLibrary pkgs.libcxx super.double-conversion;
|
2021-05-08 17:32:54 +02:00
|
|
|
|
|
2021-10-26 12:20:34 +02:00
|
|
|
|
apecs-physics = addPkgconfigDepends [
|
2021-05-08 17:32:54 +02:00
|
|
|
|
darwin.apple_sdk.frameworks.ApplicationServices
|
2021-10-26 12:20:34 +02:00
|
|
|
|
] super.apecs-physics;
|
2021-05-08 17:32:54 +02:00
|
|
|
|
|
|
|
|
|
# "erf table" test fails on Darwin
|
|
|
|
|
# https://github.com/bos/math-functions/issues/63
|
|
|
|
|
math-functions = dontCheck super.math-functions;
|
|
|
|
|
|
|
|
|
|
# darwin doesn't have sub-second resolution
|
|
|
|
|
# https://github.com/hspec/mockery/issues/11
|
2021-10-26 12:20:34 +02:00
|
|
|
|
mockery = overrideCabal (drv: {
|
2021-05-08 17:32:54 +02:00
|
|
|
|
preCheck = ''
|
|
|
|
|
export TRAVIS=true
|
|
|
|
|
'' + (drv.preCheck or "");
|
2021-10-26 12:20:34 +02:00
|
|
|
|
}) super.mockery;
|
2021-05-08 17:32:54 +02:00
|
|
|
|
|
|
|
|
|
# https://github.com/ndmitchell/shake/issues/206
|
|
|
|
|
shake = dontCheck super.shake;
|
|
|
|
|
|
|
|
|
|
filecache = dontCheck super.filecache;
|
|
|
|
|
|
|
|
|
|
# gtk/gtk3 needs to be told on Darwin to use the Quartz
|
|
|
|
|
# rather than X11 backend (see eg https://github.com/gtk2hs/gtk2hs/issues/249).
|
2021-10-26 12:20:34 +02:00
|
|
|
|
gtk3 = appendConfigureFlag "-f have-quartz-gtk" super.gtk3;
|
|
|
|
|
gtk = appendConfigureFlag "-f have-quartz-gtk" super.gtk;
|
2021-05-08 17:32:54 +02:00
|
|
|
|
|
2021-10-26 12:20:34 +02:00
|
|
|
|
OpenAL = addExtraLibrary darwin.apple_sdk.frameworks.OpenAL super.OpenAL;
|
2021-05-08 17:32:54 +02:00
|
|
|
|
|
2021-10-26 12:20:34 +02:00
|
|
|
|
al = overrideCabal (drv: {
|
2021-08-06 02:50:09 +02:00
|
|
|
|
libraryFrameworkDepends = [
|
|
|
|
|
darwin.apple_sdk.frameworks.OpenAL
|
|
|
|
|
] ++ (drv.libraryFrameworkDepends or []);
|
2021-10-26 12:20:34 +02:00
|
|
|
|
}) super.al;
|
2021-08-06 02:50:09 +02:00
|
|
|
|
|
2021-10-26 12:20:34 +02:00
|
|
|
|
proteaaudio = addExtraLibrary darwin.apple_sdk.frameworks.AudioToolbox super.proteaaudio;
|
2021-05-08 17:32:54 +02:00
|
|
|
|
|
|
|
|
|
# the system-fileio tests use canonicalizePath, which fails in the sandbox
|
|
|
|
|
system-fileio = dontCheck 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.
|
|
|
|
|
#
|
|
|
|
|
# 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.
|
2021-10-26 12:20:34 +02:00
|
|
|
|
x509-system = overrideCabal (drv:
|
2021-05-08 17:32:54 +02:00
|
|
|
|
lib.optionalAttrs (!pkgs.stdenv.cc.nativeLibc) {
|
|
|
|
|
postPatch = ''
|
|
|
|
|
substituteInPlace System/X509/MacOS.hs --replace security /usr/bin/security
|
|
|
|
|
'' + (drv.postPatch or "");
|
2021-10-26 12:20:34 +02:00
|
|
|
|
}) super.x509-system;
|
2021-05-08 17:32:54 +02:00
|
|
|
|
|
|
|
|
|
# https://github.com/haskell-foundation/foundation/pull/412
|
|
|
|
|
foundation = dontCheck super.foundation;
|
|
|
|
|
|
2021-10-26 12:20:34 +02:00
|
|
|
|
llvm-hs = overrideCabal (oldAttrs: {
|
2021-05-08 17:32:54 +02:00
|
|
|
|
# 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 = ''
|
|
|
|
|
substituteInPlace Setup.hs --replace "addToLdLibraryPath libDir" "pure ()"
|
|
|
|
|
'' + (oldAttrs.preCompileBuildDriver or "");
|
2021-10-26 12:20:34 +02:00
|
|
|
|
}) super.llvm-hs;
|
2021-05-08 17:32:54 +02:00
|
|
|
|
|
2021-10-26 12:20:34 +02:00
|
|
|
|
yesod-bin = addBuildDepend darwin.apple_sdk.frameworks.Cocoa super.yesod-bin;
|
2021-05-08 17:32:54 +02:00
|
|
|
|
|
2021-10-26 12:20:34 +02:00
|
|
|
|
hmatrix = addBuildDepend darwin.apple_sdk.frameworks.Accelerate super.hmatrix;
|
2021-05-08 17:32:54 +02:00
|
|
|
|
|
2021-10-26 12:20:34 +02:00
|
|
|
|
blas-hs = overrideCabal (drv: {
|
2021-08-06 03:13:30 +02:00
|
|
|
|
libraryFrameworkDepends = [
|
|
|
|
|
darwin.apple_sdk.frameworks.Accelerate
|
|
|
|
|
] ++ (drv.libraryFrameworkDepends or []);
|
2021-10-26 12:20:34 +02:00
|
|
|
|
}) super.blas-hs;
|
2021-08-06 03:13:30 +02:00
|
|
|
|
|
2021-05-08 17:32:54 +02:00
|
|
|
|
# Ensure the necessary frameworks are propagatedBuildInputs on darwin
|
2021-10-26 12:20:34 +02:00
|
|
|
|
OpenGLRaw = overrideCabal (drv: {
|
2021-05-08 17:32:54 +02:00
|
|
|
|
librarySystemDepends = [];
|
|
|
|
|
libraryHaskellDepends = drv.libraryHaskellDepends ++ [
|
|
|
|
|
darwin.apple_sdk.frameworks.OpenGL
|
|
|
|
|
];
|
|
|
|
|
preConfigure = ''
|
|
|
|
|
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)
|
|
|
|
|
'' + (drv.preConfigure or "");
|
2021-10-26 12:20:34 +02:00
|
|
|
|
}) super.OpenGLRaw;
|
|
|
|
|
GLURaw = overrideCabal (drv: {
|
2021-05-08 17:32:54 +02:00
|
|
|
|
librarySystemDepends = [];
|
|
|
|
|
libraryHaskellDepends = drv.libraryHaskellDepends ++ [
|
|
|
|
|
darwin.apple_sdk.frameworks.OpenGL
|
|
|
|
|
];
|
2021-10-26 12:20:34 +02:00
|
|
|
|
}) super.GLURaw;
|
|
|
|
|
bindings-GLFW = overrideCabal (drv: {
|
2021-05-08 17:32:54 +02:00
|
|
|
|
librarySystemDepends = [];
|
|
|
|
|
libraryHaskellDepends = drv.libraryHaskellDepends ++ [
|
|
|
|
|
darwin.apple_sdk.frameworks.AGL
|
|
|
|
|
darwin.apple_sdk.frameworks.Cocoa
|
|
|
|
|
darwin.apple_sdk.frameworks.OpenGL
|
|
|
|
|
darwin.apple_sdk.frameworks.IOKit
|
|
|
|
|
darwin.apple_sdk.frameworks.Kernel
|
|
|
|
|
darwin.apple_sdk.frameworks.CoreVideo
|
|
|
|
|
darwin.CF
|
|
|
|
|
];
|
2021-10-26 12:20:34 +02:00
|
|
|
|
}) super.bindings-GLFW;
|
|
|
|
|
OpenCL = overrideCabal (drv: {
|
2021-05-08 17:32:54 +02:00
|
|
|
|
librarySystemDepends = [];
|
|
|
|
|
libraryHaskellDepends = drv.libraryHaskellDepends ++ [
|
|
|
|
|
darwin.apple_sdk.frameworks.OpenCL
|
|
|
|
|
];
|
2021-10-26 12:20:34 +02:00
|
|
|
|
}) super.OpenCL;
|
2021-05-08 17:32:54 +02:00
|
|
|
|
|
|
|
|
|
# cabal2nix likes to generate dependencies on hinotify when hfsevents is
|
|
|
|
|
# really required on darwin: https://github.com/NixOS/cabal2nix/issues/146.
|
|
|
|
|
hinotify = self.hfsevents;
|
|
|
|
|
|
|
|
|
|
# FSEvents API is very buggy and tests are unreliable. See
|
|
|
|
|
# http://openradar.appspot.com/10207999 and similar issues.
|
2021-10-26 12:20:34 +02:00
|
|
|
|
fsnotify = addBuildDepend darwin.apple_sdk.frameworks.Cocoa
|
|
|
|
|
(dontCheck super.fsnotify);
|
2021-05-08 17:32:54 +02:00
|
|
|
|
|
2021-10-26 12:20:34 +02:00
|
|
|
|
FractalArt = overrideCabal (drv: {
|
2021-05-08 17:32:54 +02:00
|
|
|
|
librarySystemDepends = [
|
|
|
|
|
darwin.libobjc
|
|
|
|
|
darwin.apple_sdk.frameworks.AppKit
|
|
|
|
|
] ++ (drv.librarySystemDepends or []);
|
2021-10-26 12:20:34 +02:00
|
|
|
|
}) super.FractalArt;
|
2021-05-08 17:32:54 +02:00
|
|
|
|
|
2021-10-26 12:20:34 +02:00
|
|
|
|
arbtt = overrideCabal (drv: {
|
2021-05-08 17:32:54 +02:00
|
|
|
|
librarySystemDepends = [
|
|
|
|
|
darwin.apple_sdk.frameworks.Foundation
|
|
|
|
|
darwin.apple_sdk.frameworks.Carbon
|
|
|
|
|
darwin.apple_sdk.frameworks.IOKit
|
|
|
|
|
] ++ (drv.librarySystemDepends or []);
|
2021-10-26 12:20:34 +02:00
|
|
|
|
}) super.arbtt;
|
2021-05-08 17:32:54 +02:00
|
|
|
|
|
2021-10-26 12:20:34 +02:00
|
|
|
|
HTF = overrideCabal (drv: {
|
2021-05-09 01:41:11 +02:00
|
|
|
|
# GNU find is not prefixed in stdenv
|
|
|
|
|
postPatch = ''
|
|
|
|
|
substituteInPlace scripts/local-htfpp --replace "find=gfind" "find=find"
|
|
|
|
|
'' + (drv.postPatch or "");
|
2021-10-26 12:20:34 +02:00
|
|
|
|
}) super.HTF;
|
2021-05-09 01:41:11 +02:00
|
|
|
|
|
2021-08-06 03:32:50 +02:00
|
|
|
|
# conditional dependency via a cabal flag
|
2021-10-26 12:20:34 +02:00
|
|
|
|
cas-store = overrideCabal (drv: {
|
2021-08-06 03:32:50 +02:00
|
|
|
|
libraryHaskellDepends = [
|
|
|
|
|
self.kqueue
|
|
|
|
|
] ++ (drv.libraryHaskellDepends or []);
|
2021-10-26 12:20:34 +02:00
|
|
|
|
}) super.cas-store;
|
2021-08-06 03:32:50 +02:00
|
|
|
|
|
2021-05-25 13:00:46 +02:00
|
|
|
|
# 2021-05-25: Tests fail and I have no way to debug them.
|
|
|
|
|
hls-class-plugin = dontCheck super.hls-class-plugin;
|
2021-06-15 16:09:54 +02:00
|
|
|
|
hls-brittany-plugin = dontCheck super.hls-brittany-plugin;
|
2021-06-21 01:38:58 +02:00
|
|
|
|
hls-fourmolu-plugin = dontCheck super.hls-fourmolu-plugin;
|
2021-06-22 04:23:46 +02:00
|
|
|
|
hls-module-name-plugin = dontCheck super.hls-module-name-plugin;
|
2021-06-27 12:01:37 +02:00
|
|
|
|
hls-splice-plugin = dontCheck super.hls-splice-plugin;
|
2021-08-03 23:02:05 +02:00
|
|
|
|
hls-ormolu-plugin = dontCheck super.hls-ormolu-plugin;
|
2021-08-18 11:34:15 +02:00
|
|
|
|
hls-pragmas-plugin = dontCheck super.hls-pragmas-plugin;
|
2021-08-18 11:43:02 +02:00
|
|
|
|
hls-haddock-comments-plugin = dontCheck super.hls-haddock-comments-plugin;
|
2021-08-25 19:20:17 +02:00
|
|
|
|
hls-floskell-plugin = dontCheck super.hls-floskell-plugin;
|
2021-09-30 11:39:38 +02:00
|
|
|
|
hls-call-hierarchy-plugin = dontCheck super.hls-call-hierarchy-plugin;
|
2021-05-25 13:00:46 +02:00
|
|
|
|
|
2021-06-22 16:00:19 +02:00
|
|
|
|
# We are lacking pure pgrep at the moment for tests to work
|
|
|
|
|
tmp-postgres = dontCheck super.tmp-postgres;
|
|
|
|
|
|
2021-08-05 08:28:42 +02:00
|
|
|
|
# On darwin librt doesn't exist and will fail to link against,
|
|
|
|
|
# however linking against it is also not necessary there
|
2021-10-26 12:20:34 +02:00
|
|
|
|
GLHUI = overrideCabal (drv: {
|
2021-08-05 08:28:42 +02:00
|
|
|
|
postPatch = ''
|
|
|
|
|
substituteInPlace GLHUI.cabal --replace " rt" ""
|
|
|
|
|
'' + (drv.postPatch or "");
|
2021-10-26 12:20:34 +02:00
|
|
|
|
}) super.GLHUI;
|
2021-08-05 08:28:42 +02:00
|
|
|
|
|
2021-10-26 12:20:34 +02:00
|
|
|
|
SDL-image = overrideCabal (drv: {
|
2021-08-06 01:46:44 +02:00
|
|
|
|
# Prevent darwin-specific configuration code path being taken
|
|
|
|
|
# which doesn't work with nixpkgs' SDL libraries
|
|
|
|
|
postPatch = ''
|
|
|
|
|
substituteInPlace configure --replace xDarwin noDarwinSpecialCasing
|
|
|
|
|
'' + (drv.postPatch or "");
|
|
|
|
|
patches = [
|
|
|
|
|
# Work around SDL_main.h redefining main to SDL_main
|
|
|
|
|
./patches/SDL-image-darwin-hsc.patch
|
|
|
|
|
];
|
2021-10-26 12:20:34 +02:00
|
|
|
|
}) super.SDL-image;
|
2021-08-06 01:46:44 +02:00
|
|
|
|
|
2021-08-06 01:43:59 +02:00
|
|
|
|
# Prevent darwin-specific configuration code path being taken which
|
|
|
|
|
# doesn't work with nixpkgs' SDL libraries
|
2021-10-26 12:20:34 +02:00
|
|
|
|
SDL-mixer = overrideCabal (drv: {
|
2021-08-06 01:43:59 +02:00
|
|
|
|
postPatch = ''
|
|
|
|
|
substituteInPlace configure --replace xDarwin noDarwinSpecialCasing
|
|
|
|
|
'' + (drv.postPatch or "");
|
2021-10-26 12:20:34 +02:00
|
|
|
|
}) super.SDL-mixer;
|
2021-08-06 01:43:59 +02:00
|
|
|
|
|
2021-08-06 01:40:03 +02:00
|
|
|
|
# Work around SDL_main.h redefining main to SDL_main
|
2021-10-26 12:20:34 +02:00
|
|
|
|
SDL-ttf = appendPatch ./patches/SDL-ttf-darwin-hsc.patch super.SDL-ttf;
|
2021-08-06 01:40:03 +02:00
|
|
|
|
|
2021-08-06 14:56:42 +02:00
|
|
|
|
# Disable a bunch of test suites that fail because of darwin's case insensitive
|
|
|
|
|
# file system: When a test suite has a test suite file that has the same name
|
|
|
|
|
# as a module in scope, but in different case (e. g. hedgehog.hs and Hedgehog
|
|
|
|
|
# in scope), GHC will complain that the file name and module name differ (in
|
|
|
|
|
# the example hedgehog.hs would be Main).
|
|
|
|
|
# These failures can easily be fixed by upstream by renaming files, so we
|
|
|
|
|
# should create issues for them.
|
|
|
|
|
# https://github.com/typeclasses/aws-cloudfront-signed-cookies/issues/2
|
|
|
|
|
aws-cloudfront-signed-cookies = dontCheck super.aws-cloudfront-signed-cookies;
|
|
|
|
|
|
2021-08-06 15:12:42 +02:00
|
|
|
|
# https://github.com/acid-state/acid-state/issues/133
|
|
|
|
|
acid-state = dontCheck super.acid-state;
|
|
|
|
|
|
2021-08-06 15:43:20 +02:00
|
|
|
|
# Otherwise impure gcc is used, which is Apple's weird wrapper
|
2021-10-26 12:20:34 +02:00
|
|
|
|
c2hsc = addTestToolDepends [ pkgs.gcc ] super.c2hsc;
|
2021-08-06 15:43:20 +02:00
|
|
|
|
|
2021-11-09 12:47:35 +01:00
|
|
|
|
# streamly depends on Cocoa starting with 0.8.0
|
2021-12-08 12:16:55 +01:00
|
|
|
|
streamly_0_8_1_1 = overrideCabal (drv: {
|
2021-11-09 12:47:35 +01:00
|
|
|
|
libraryFrameworkDepends = [
|
|
|
|
|
darwin.apple_sdk.frameworks.Cocoa
|
|
|
|
|
] ++ (drv.libraryFrameworkDepends or []);
|
2021-12-08 12:16:55 +01:00
|
|
|
|
}) super.streamly_0_8_1_1;
|
2021-11-09 12:47:35 +01:00
|
|
|
|
|
2021-08-28 14:47:58 +02:00
|
|
|
|
} // lib.optionalAttrs pkgs.stdenv.isAarch64 { # aarch64-darwin
|
|
|
|
|
|
|
|
|
|
# https://github.com/fpco/unliftio/issues/87
|
|
|
|
|
unliftio = dontCheck super.unliftio;
|
|
|
|
|
|
|
|
|
|
# https://github.com/fpco/inline-c/issues/127
|
|
|
|
|
inline-c-cpp = dontCheck super.inline-c-cpp;
|
|
|
|
|
})
|