about summary refs log tree commit diff
path: root/pkgs/development/haskell-modules
diff options
context:
space:
mode:
authorDavid Johnson <djohnson.m@gmail.com>2017-02-04 11:19:14 -0600
committerDavid Johnson <djohnson.m@gmail.com>2017-03-10 19:31:12 -0600
commit26623240e93f8454ac69f66a3a025d98a7e94b71 (patch)
treee929462cc37cde5d489f87bcf3bbe40be5b5f601 /pkgs/development/haskell-modules
parent2839b101f927be5daab7948421de00a6f6c084ae (diff)
downloadnixlib-26623240e93f8454ac69f66a3a025d98a7e94b71.tar
nixlib-26623240e93f8454ac69f66a3a025d98a7e94b71.tar.gz
nixlib-26623240e93f8454ac69f66a3a025d98a7e94b71.tar.bz2
nixlib-26623240e93f8454ac69f66a3a025d98a7e94b71.tar.lz
nixlib-26623240e93f8454ac69f66a3a025d98a7e94b71.tar.xz
nixlib-26623240e93f8454ac69f66a3a025d98a7e94b71.tar.zst
nixlib-26623240e93f8454ac69f66a3a025d98a7e94b71.zip
Init HaLVM at 2.4.0
Diffstat (limited to 'pkgs/development/haskell-modules')
-rw-r--r--pkgs/development/haskell-modules/configuration-halvm-2.4.0.nix59
-rw-r--r--pkgs/development/haskell-modules/generic-builder.nix20
-rw-r--r--pkgs/development/haskell-modules/with-packages-wrapper.nix9
3 files changed, 74 insertions, 14 deletions
diff --git a/pkgs/development/haskell-modules/configuration-halvm-2.4.0.nix b/pkgs/development/haskell-modules/configuration-halvm-2.4.0.nix
new file mode 100644
index 000000000000..cd7857e23de9
--- /dev/null
+++ b/pkgs/development/haskell-modules/configuration-halvm-2.4.0.nix
@@ -0,0 +1,59 @@
+{ pkgs }:
+
+with import ./lib.nix { inherit pkgs; };
+
+self: super: {
+
+  # Suitable LLVM version.
+  llvmPackages = pkgs.llvmPackages_35;
+
+  # Disable GHC 8.0.x core libraries.
+  array = null;
+  base = null;
+  binary = null;
+  bytestring = null;
+  Cabal = null;
+  containers = null;
+  deepseq = null;
+  directory = null;
+  filepath = null;
+  ghc-boot = null;
+  ghc-boot-th = null;
+  ghc-prim = null;
+  ghci = null;
+  haskeline = null;
+  hoopl = null;
+  hpc = null;
+  integer-gmp = null;
+  pretty = null;
+  process = null;
+  rts = null;
+  template-haskell = null;
+  terminfo = null;
+  time = null;
+  transformers = null;
+  unix = null;
+  xhtml = null;
+
+  # cabal-install can use the native Cabal library.
+  cabal-install = super.cabal-install.override { Cabal = null; };
+
+  # jailbreak-cabal can use the native Cabal library.
+  jailbreak-cabal = super.jailbreak-cabal.override { Cabal = null; };
+
+  # https://github.com/bmillwood/applicative-quoters/issues/6
+  applicative-quoters = appendPatch super.applicative-quoters (pkgs.fetchpatch {
+    url = "https://patch-diff.githubusercontent.com/raw/bmillwood/applicative-quoters/pull/7.patch";
+    sha256 = "026vv2k3ks73jngwifszv8l59clg88pcdr4mz0wr0gamivkfa1zy";
+  });
+
+  # https://github.com/christian-marie/xxhash/issues/3
+  xxhash = doJailbreak super.xxhash;
+
+  # https://github.com/Deewiant/glob/issues/8
+  Glob = doJailbreak super.Glob;
+
+  # http://hub.darcs.net/dolio/vector-algorithms/issue/9#comment-20170112T145715
+  vector-algorithms = dontCheck super.vector-algorithms;
+
+}
diff --git a/pkgs/development/haskell-modules/generic-builder.nix b/pkgs/development/haskell-modules/generic-builder.nix
index e47375e71c73..64924f7252e0 100644
--- a/pkgs/development/haskell-modules/generic-builder.nix
+++ b/pkgs/development/haskell-modules/generic-builder.nix
@@ -66,7 +66,8 @@ let
                        concatStringsSep enableFeature optionalAttrs toUpper;
 
   isGhcjs = ghc.isGhcjs or false;
-  packageDbFlag = if isGhcjs || versionOlder "7.6" ghc.version
+  isHaLVM = ghc.isHaLVM or false;
+  packageDbFlag = if isGhcjs || isHaLVM || versionOlder "7.6" ghc.version
                   then "package-db"
                   else "package-conf";
 
@@ -99,16 +100,15 @@ let
     "--with-ghc-pkg=${ghc.cross.config}-ghc-pkg"
     "--with-gcc=${ghc.cc}"
     "--with-ld=${ghc.ld}"
-    "--hsc2hs-options=--cross-compile"
     "--with-hsc2hs=${nativeGhc}/bin/hsc2hs"
-  ];
+  ] ++ (if isHaLVM then [] else ["--hsc2hs-options=--cross-compile"]);
 
   crossCabalFlagsString =
     stdenv.lib.optionalString isCross (" " + stdenv.lib.concatStringsSep " " crossCabalFlags);
 
   defaultConfigureFlags = [
     "--verbose" "--prefix=$out" "--libdir=\\$prefix/lib/\\$compiler" "--libsubdir=\\$pkgid"
-    "--with-gcc=$CC"            # Clang won't work without that extra information.
+    "--with-gcc=$CC" # Clang won't work without that extra information.
     "--package-db=$packageConfDir"
     (optionalString (enableSharedExecutables && stdenv.isLinux) "--ghc-option=-optl=-Wl,-rpath=$out/lib/${ghc.name}/${pname}-${version}")
     (optionalString (enableSharedExecutables && stdenv.isDarwin) "--ghc-option=-optl=-Wl,-headerpad_max_install_names")
@@ -133,8 +133,9 @@ let
 
   setupCompileFlags = [
     (optionalString (!coreSetup) "-${packageDbFlag}=$packageConfDir")
-    (optionalString (isGhcjs || versionOlder "7.8" ghc.version) "-j$NIX_BUILD_CORES")
-    (optionalString (versionOlder "7.10" ghc.version) "-threaded") # https://github.com/haskell/cabal/issues/2398
+    (optionalString (isGhcjs || isHaLVM || versionOlder "7.8" ghc.version) "-j$NIX_BUILD_CORES")
+    # https://github.com/haskell/cabal/issues/2398
+    (optionalString (versionOlder "7.10" ghc.version && !isHaLVM) "-threaded")
   ];
 
   isHaskellPkg = x: (x ? pname) && (x ? version) && (x ? env);
@@ -319,11 +320,10 @@ stdenv.mkDerivation ({
         export NIX_${ghcCommandCaps}="${ghcEnv}/bin/${ghcCommand}"
         export NIX_${ghcCommandCaps}PKG="${ghcEnv}/bin/${ghcCommand}-pkg"
         export NIX_${ghcCommandCaps}_DOCDIR="${ghcEnv}/share/doc/ghc/html"
-        export NIX_${ghcCommandCaps}_LIBDIR="${ghcEnv}/lib/${ghcCommand}-${ghc.version}"
-        ${shellHook}
-      '';
+        '' + (if isHaLVM
+	       then ''export NIX_${ghcCommandCaps}_LIBDIR="${ghcEnv}/lib/HaLVM-${ghc.version}"''
+	       else ''export NIX_${ghcCommandCaps}_LIBDIR="${ghcEnv}/lib/${ghcCommand}-${ghc.version}"'') + "${shellHook}";
     };
-
   };
 
   meta = { inherit homepage license platforms; }
diff --git a/pkgs/development/haskell-modules/with-packages-wrapper.nix b/pkgs/development/haskell-modules/with-packages-wrapper.nix
index e04cbe08c2c7..15d66bbd6dc0 100644
--- a/pkgs/development/haskell-modules/with-packages-wrapper.nix
+++ b/pkgs/development/haskell-modules/with-packages-wrapper.nix
@@ -8,7 +8,7 @@
 assert ghcLibdir != null -> (ghc.isGhcjs or false);
 
 # This wrapper works only with GHC 6.12 or later.
-assert lib.versionOlder "6.12" ghc.version || ghc.isGhcjs;
+assert lib.versionOlder "6.12" ghc.version || ghc.isGhcjs || ghc.isHaLVM;
 
 # It's probably a good idea to include the library "ghc-paths" in the
 # compiler environment, because we have a specially patched version of
@@ -33,13 +33,14 @@ assert lib.versionOlder "6.12" ghc.version || ghc.isGhcjs;
 
 let
   isGhcjs       = ghc.isGhcjs or false;
-  ghc761OrLater = isGhcjs || lib.versionOlder "7.6.1" ghc.version;
+  isHaLVM       = ghc.isHaLVM or false;
+  ghc761OrLater = isGhcjs || isHaLVM || lib.versionOlder "7.6.1" ghc.version;
   packageDBFlag = if ghc761OrLater then "--global-package-db" else "--global-conf";
-  ghcCommand'    = if isGhcjs then "ghcjs" else "ghc";
+  ghcCommand'   = if isGhcjs then "ghcjs" else "ghc";
   crossPrefix = if (ghc.cross or null) != null then "${ghc.cross.config}-" else "";
   ghcCommand = "${crossPrefix}${ghcCommand'}";
   ghcCommandCaps= lib.toUpper ghcCommand';
-  libDir        = "$out/lib/${ghcCommand}-${ghc.version}";
+  libDir        = if isHaLVM then "$out/lib/HaLVM-${ghc.version}" else "$out/lib/${ghcCommand}-${ghc.version}";
   docDir        = "$out/share/doc/ghc/html";
   packageCfgDir = "${libDir}/package.conf.d";
   paths         = lib.filter (x: x ? isHaskellLibrary) (lib.closePropagation packages);