diff options
-rw-r--r-- | pkgs/development/haskell-modules/default.nix | 11 | ||||
-rw-r--r-- | pkgs/development/haskell-modules/generic-builder.nix | 8 |
2 files changed, 17 insertions, 2 deletions
diff --git a/pkgs/development/haskell-modules/default.nix b/pkgs/development/haskell-modules/default.nix index ecfb5cf5c4e4..8978486e9308 100644 --- a/pkgs/development/haskell-modules/default.nix +++ b/pkgs/development/haskell-modules/default.nix @@ -25,6 +25,17 @@ let hyperlinkSource = false; # Avoid depending on hscolour for this build. postFixup = "rm -rf $out/lib $out/share $out/nix-support"; }); + cpphs = overrideCabal (self.cpphs.overrideScope (self: super: { + mkDerivation = drv: super.mkDerivation (drv // { + enableSharedExecutables = false; + enableSharedLibraries = false; + noHaddock = true; + useCpphs = false; + }); + })) (drv: { + isLibrary = false; + postFixup = "rm -rf $out/lib $out/share $out/nix-support"; + }); }; overrideCabal = drv: f: drv.override (args: args // { diff --git a/pkgs/development/haskell-modules/generic-builder.nix b/pkgs/development/haskell-modules/generic-builder.nix index f8cca65aeb67..7290bb947e15 100644 --- a/pkgs/development/haskell-modules/generic-builder.nix +++ b/pkgs/development/haskell-modules/generic-builder.nix @@ -1,5 +1,5 @@ { stdenv, fetchurl, ghc, pkgconfig, glibcLocales, coreutils, gnugrep, gnused -, jailbreak-cabal, hscolour +, jailbreak-cabal, hscolour, cpphs }: { pname @@ -39,7 +39,8 @@ , preInstall ? "", postInstall ? "" , checkPhase ? "", preCheck ? "", postCheck ? "" , preFixup ? "", postFixup ? "" -, coreSetup ? false # Use core packages to build Setup.hs +, coreSetup ? false # Use only core packages to build Setup.hs. +, useCpphs ? stdenv.isDarwin }: assert pkgconfigDepends != [] -> pkgconfig != null; @@ -119,6 +120,9 @@ stdenv.mkDerivation ({ setupCompileFlags="-j$NIX_BUILD_CORES" ''}${optionalString stdenv.isDarwin '' configureFlags+=" --with-gcc=$CC" # Cabal won't find clang without help. + ''}${optionalString useCpphs '' + configureFlags+=" --with-cpphs=${cpphs}/bin/cpphs" + configureFlags+=" --ghc-options=-cpp --ghc-options=-pgmP${cpphs}/bin/cpphs --ghc-options=-optP--cpp" ''} packageConfDir="$TMP/package.conf.d" |