@@ -0,0 +1,44 @@
1+{ stdenv, fetchurl, ghc, perl, gmp, ncurses }:
2+
3+stdenv.mkDerivation rec {
4+ version = "7.8.4";
5+ name = "ghc-${version}";
6+
7+ src = fetchurl {
8+ url = "http://www.haskell.org/ghc/dist/7.8.4/${name}-src.tar.xz";
9+ sha256 = "1i4254akbb4ym437rf469gc0m40bxm31blp6s1z1g15jmnacs6f3";
10+ };
11+
12+ buildInputs = [ ghc perl gmp ncurses ];
13+
14+ enableParallelBuilding = true;
15+
16+ buildMK = ''
17+ libraries/integer-gmp_CONFIGURE_OPTS += --configure-option=--with-gmp-libraries="${gmp}/lib"
18+ libraries/integer-gmp_CONFIGURE_OPTS += --configure-option=--with-gmp-includes="${gmp}/include"
19+ DYNAMIC_BY_DEFAULT = NO
20+ '';
21+
22+ preConfigure = ''
23+ echo "${buildMK}" > mk/build.mk
24+ sed -i -e 's|-isysroot /Developer/SDKs/MacOSX10.5.sdk||' configure
25+ '' + stdenv.lib.optionalString (!stdenv.isDarwin) ''
26+ export NIX_LDFLAGS="$NIX_LDFLAGS -rpath $out/lib/ghc-${version}"
27+ '';
28+
29+ # required, because otherwise all symbols from HSffi.o are stripped, and
30+ # that in turn causes GHCi to abort
31+ stripDebugFlags = [ "-S" "--keep-file-symbols" ];
32+
33+ meta = with stdenv.lib; {
34+ homepage = "http://haskell.org/ghc";
35+ description = "The Glasgow Haskell Compiler";
36+ maintainers = [ maintainers.marcweber maintainers.andres maintainers.simons ];
37+ inherit (ghc.meta) license;
38+ # Filter old "i686-darwin" platform which is unsupported these days.
39+ platforms = filter (x: elem x platforms.all) ghc.meta.platforms;
40+ # Disable Darwin builds: <https://github.com/NixOS/nixpkgs/issues/2689>.
41+ hydraPlatforms = filter (x: !elem x platforms.darwin) meta.platforms;
42+ };
43+
44+}