about summary refs log tree commit diff
path: root/pkgs/top-level/haskell-packages.nix
diff options
context:
space:
mode:
Diffstat (limited to 'pkgs/top-level/haskell-packages.nix')
-rw-r--r--pkgs/top-level/haskell-packages.nix208
1 files changed, 121 insertions, 87 deletions
diff --git a/pkgs/top-level/haskell-packages.nix b/pkgs/top-level/haskell-packages.nix
index 6193d9d217ae..b3f6a71d3315 100644
--- a/pkgs/top-level/haskell-packages.nix
+++ b/pkgs/top-level/haskell-packages.nix
@@ -1,4 +1,4 @@
-{ buildPackages, pkgsBuildTarget, pkgs, newScope, stdenv }:
+{ buildPackages, pkgsBuildBuild, pkgsBuildTarget, pkgs, newScope, stdenv }:
 
 let
   # These are attributes in compiler that support integer-simple.
@@ -52,7 +52,18 @@ in {
 
   package-list = callPackage ../development/haskell-modules/package-list.nix {};
 
-  compiler = {
+  # Always get boot compilers from `pkgsBuildBuild`. The boot (stage0) compiler
+  # is used to build another compiler (stage1) that'll be used to build the
+  # final compiler (stage2) (except when building a cross-compiler). This means
+  # that stage1's host platform is the same as stage0: build. Consequently,
+  # stage0 needs to be build->build.
+  #
+  # Note that we use bb.haskell.packages.*. haskell.packages.*.ghc is similar to
+  # stdenv: The ghc comes from the previous package set, i.e. this predicate holds:
+  # `name: pkgs: pkgs.haskell.packages.${name}.ghc == pkgs.buildPackages.haskell.compiler.${name}.ghc`.
+  # This isn't problematic since pkgsBuildBuild.buildPackages is also build->build,
+  # just something to keep in mind.
+  compiler = let bb = pkgsBuildBuild.haskell; in {
     ghc865Binary = callPackage ../development/compilers/ghc/8.6.5-binary.nix {
       # Should be llvmPackages_6 which has been removed from nixpkgs
       llvmPackages = null;
@@ -73,11 +84,11 @@ in {
     ghc8107 = callPackage ../development/compilers/ghc/8.10.7.nix {
       bootPkgs =
         # the oldest ghc with aarch64-darwin support is 8.10.5
-        if stdenv.hostPlatform.isPower64 && stdenv.hostPlatform.isLittleEndian then
+        if stdenv.buildPlatform.isPower64 && stdenv.buildPlatform.isLittleEndian then
           # to my (@a-m-joseph) knowledge there are no newer official binaries for this platform
-          packages.ghc865Binary
+          bb.packages.ghc865Binary
         else
-          packages.ghc8107Binary;
+          bb.packages.ghc8107Binary;
       inherit (buildPackages.python311Packages) sphinx; # a distutils issue with 3.12
       python3 = buildPackages.python311; # so that we don't have two of them
       # Need to use apple's patched xattr until
@@ -91,10 +102,10 @@ in {
     ghc902 = callPackage ../development/compilers/ghc/9.0.2.nix {
       bootPkgs =
         # the oldest ghc with aarch64-darwin support is 8.10.5
-        if stdenv.hostPlatform.isPower64 && stdenv.hostPlatform.isLittleEndian then
-          packages.ghc810
+        if stdenv.buildPlatform.isPower64 && stdenv.buildPlatform.isLittleEndian then
+          bb.packages.ghc810
         else
-          packages.ghc8107Binary;
+          bb.packages.ghc8107Binary;
       inherit (buildPackages.python311Packages) sphinx; # a distutils issue with 3.12
       python3 = buildPackages.python311; # so that we don't have two of them
       inherit (buildPackages.darwin) autoSignDarwinBinariesHook xattr;
@@ -104,10 +115,10 @@ in {
     ghc90 = compiler.ghc902;
     ghc925 = callPackage ../development/compilers/ghc/9.2.5.nix {
       bootPkgs =
-        if stdenv.hostPlatform.isPower64 && stdenv.hostPlatform.isLittleEndian then
-          packages.ghc810
+        if stdenv.buildPlatform.isPower64 && stdenv.buildPlatform.isLittleEndian then
+          bb.packages.ghc810
         else
-          packages.ghc8107Binary;
+          bb.packages.ghc8107Binary;
       inherit (buildPackages.python311Packages) sphinx; # a distutils issue with 3.12
       python3 = buildPackages.python311; # so that we don't have two of them
       # Need to use apple's patched xattr until
@@ -119,10 +130,10 @@ in {
     };
     ghc926 = callPackage ../development/compilers/ghc/9.2.6.nix {
       bootPkgs =
-        if stdenv.hostPlatform.isPower64 && stdenv.hostPlatform.isLittleEndian then
-          packages.ghc810
+        if stdenv.buildPlatform.isPower64 && stdenv.buildPlatform.isLittleEndian then
+          bb.packages.ghc810
         else
-          packages.ghc8107Binary;
+          bb.packages.ghc8107Binary;
       inherit (buildPackages.python311Packages) sphinx; # a distutils issue with 3.12
       python3 = buildPackages.python311; # so that we don't have two of them
       # Need to use apple's patched xattr until
@@ -134,10 +145,10 @@ in {
     };
     ghc927 = callPackage ../development/compilers/ghc/9.2.7.nix {
       bootPkgs =
-        if stdenv.hostPlatform.isPower64 && stdenv.hostPlatform.isLittleEndian then
-          packages.ghc810
+        if stdenv.buildPlatform.isPower64 && stdenv.buildPlatform.isLittleEndian then
+          bb.packages.ghc810
         else
-          packages.ghc8107Binary;
+          bb.packages.ghc8107Binary;
       inherit (buildPackages.python311Packages) sphinx; # a distutils issue with 3.12
       python3 = buildPackages.python311; # so that we don't have two of them
       # Need to use apple's patched xattr until
@@ -149,10 +160,10 @@ in {
     };
     ghc928 = callPackage ../development/compilers/ghc/9.2.8.nix {
       bootPkgs =
-        if stdenv.hostPlatform.isPower64 && stdenv.hostPlatform.isLittleEndian then
-          packages.ghc810
+        if stdenv.buildPlatform.isPower64 && stdenv.buildPlatform.isLittleEndian then
+          bb.packages.ghc810
         else
-          packages.ghc8107Binary;
+          bb.packages.ghc8107Binary;
       inherit (buildPackages.python311Packages) sphinx; # a distutils issue with 3.12
       python3 = buildPackages.python311; # so that we don't have two of them
       # Need to use apple's patched xattr until
@@ -170,14 +181,14 @@ in {
         # Use 8.10 as a workaround where possible to keep bootstrap path short.
 
         # On ARM text won't build with GHC 8.10.*
-        if stdenv.hostPlatform.isAarch then
+        if stdenv.buildPlatform.isAarch then
           # TODO(@sternenseemann): package bindist
-          packages.ghc902
+          bb.packages.ghc902
         # No suitable bindists for powerpc64le
-        else if stdenv.hostPlatform.isPower64 && stdenv.hostPlatform.isLittleEndian then
-          packages.ghc902
+        else if stdenv.buildPlatform.isPower64 && stdenv.buildPlatform.isLittleEndian then
+          bb.packages.ghc902
         else
-          packages.ghc8107Binary;
+          bb.packages.ghc8107Binary;
       inherit (buildPackages.python311Packages) sphinx; # a distutils issue with 3.12
       python3 = buildPackages.python311; # so that we don't have two of them
       # Need to use apple's patched xattr until
@@ -195,14 +206,14 @@ in {
         # Use 8.10 as a workaround where possible to keep bootstrap path short.
 
         # On ARM text won't build with GHC 8.10.*
-        if stdenv.hostPlatform.isAarch then
+        if stdenv.buildPlatform.isAarch then
           # TODO(@sternenseemann): package bindist
-          packages.ghc902
+          bb.packages.ghc902
         # No suitable bindists for powerpc64le
-        else if stdenv.hostPlatform.isPower64 && stdenv.hostPlatform.isLittleEndian then
-          packages.ghc902
+        else if stdenv.buildPlatform.isPower64 && stdenv.buildPlatform.isLittleEndian then
+          bb.packages.ghc902
         else
-          packages.ghc8107Binary;
+          bb.packages.ghc8107Binary;
       inherit (buildPackages.python311Packages) sphinx; # a distutils issue with 3.12
       python3 = buildPackages.python311; # so that we don't have two of them
       # Need to use apple's patched xattr until
@@ -220,14 +231,14 @@ in {
         # Use 8.10 as a workaround where possible to keep bootstrap path short.
 
         # On ARM text won't build with GHC 8.10.*
-        if stdenv.hostPlatform.isAarch then
+        if stdenv.buildPlatform.isAarch then
           # TODO(@sternenseemann): package bindist
-          packages.ghc902
+          bb.packages.ghc902
         # No suitable bindists for powerpc64le
-        else if stdenv.hostPlatform.isPower64 && stdenv.hostPlatform.isLittleEndian then
-          packages.ghc902
+        else if stdenv.buildPlatform.isPower64 && stdenv.buildPlatform.isLittleEndian then
+          bb.packages.ghc902
         else
-          packages.ghc8107Binary;
+          bb.packages.ghc8107Binary;
       inherit (buildPackages.python3Packages) sphinx;
       # Need to use apple's patched xattr until
       # https://github.com/xattr/xattr/issues/44 and
@@ -244,14 +255,14 @@ in {
         # Use 8.10 as a workaround where possible to keep bootstrap path short.
 
         # On ARM text won't build with GHC 8.10.*
-        if stdenv.hostPlatform.isAarch then
+        if stdenv.buildPlatform.isAarch then
           # TODO(@sternenseemann): package bindist
-          packages.ghc902
+          bb.packages.ghc902
         # No suitable bindists for powerpc64le
-        else if stdenv.hostPlatform.isPower64 && stdenv.hostPlatform.isLittleEndian then
-          packages.ghc902
+        else if stdenv.buildPlatform.isPower64 && stdenv.buildPlatform.isLittleEndian then
+          bb.packages.ghc902
         else
-          packages.ghc8107Binary;
+          bb.packages.ghc8107Binary;
       inherit (buildPackages.python3Packages) sphinx;
       # Need to use apple's patched xattr until
       # https://github.com/xattr/xattr/issues/44 and
@@ -265,12 +276,12 @@ in {
     ghc963 = callPackage ../development/compilers/ghc/9.6.3.nix {
       bootPkgs =
         # For GHC 9.2 no armv7l bindists are available.
-        if stdenv.hostPlatform.isAarch32 then
-          packages.ghc928
-        else if stdenv.hostPlatform.isPower64 && stdenv.hostPlatform.isLittleEndian then
-          packages.ghc928
+        if stdenv.buildPlatform.isAarch32 then
+          bb.packages.ghc928
+        else if stdenv.buildPlatform.isPower64 && stdenv.buildPlatform.isLittleEndian then
+          bb.packages.ghc928
         else
-          packages.ghc924Binary;
+          bb.packages.ghc924Binary;
       inherit (buildPackages.python3Packages) sphinx;
       # Need to use apple's patched xattr until
       # https://github.com/xattr/xattr/issues/44 and
@@ -283,12 +294,12 @@ in {
     ghc964 = callPackage ../development/compilers/ghc/9.6.4.nix {
       bootPkgs =
         # For GHC 9.2 no armv7l bindists are available.
-        if stdenv.hostPlatform.isAarch32 then
-          packages.ghc928
-        else if stdenv.hostPlatform.isPower64 && stdenv.hostPlatform.isLittleEndian then
-          packages.ghc928
+        if stdenv.buildPlatform.isAarch32 then
+          bb.packages.ghc928
+        else if stdenv.buildPlatform.isPower64 && stdenv.buildPlatform.isLittleEndian then
+          bb.packages.ghc928
         else
-          packages.ghc924Binary;
+          bb.packages.ghc924Binary;
       inherit (buildPackages.python3Packages) sphinx;
       # Need to use apple's patched xattr until
       # https://github.com/xattr/xattr/issues/44 and
@@ -301,12 +312,12 @@ in {
     ghc965 = callPackage ../development/compilers/ghc/9.6.5.nix {
       bootPkgs =
         # For GHC 9.2 no armv7l bindists are available.
-        if stdenv.hostPlatform.isAarch32 then
-          packages.ghc928
-        else if stdenv.hostPlatform.isPower64 && stdenv.hostPlatform.isLittleEndian then
-          packages.ghc928
+        if stdenv.buildPlatform.isAarch32 then
+          bb.packages.ghc928
+        else if stdenv.buildPlatform.isPower64 && stdenv.buildPlatform.isLittleEndian then
+          bb.packages.ghc928
         else
-          packages.ghc924Binary;
+          bb.packages.ghc924Binary;
       inherit (buildPackages.python3Packages) sphinx;
       # Need to use apple's patched xattr until
       # https://github.com/xattr/xattr/issues/44 and
@@ -319,12 +330,12 @@ in {
     ghc966 = callPackage ../development/compilers/ghc/9.6.6.nix {
       bootPkgs =
         # For GHC 9.2 no armv7l bindists are available.
-        if stdenv.hostPlatform.isAarch32 then
-          packages.ghc928
-        else if stdenv.hostPlatform.isPower64 && stdenv.hostPlatform.isLittleEndian then
-          packages.ghc928
+        if stdenv.buildPlatform.isAarch32 then
+          bb.packages.ghc928
+        else if stdenv.buildPlatform.isPower64 && stdenv.buildPlatform.isLittleEndian then
+          bb.packages.ghc928
         else
-          packages.ghc924Binary;
+          bb.packages.ghc924Binary;
       inherit (buildPackages.python3Packages) sphinx;
       # Need to use apple's patched xattr until
       # https://github.com/xattr/xattr/issues/44 and
@@ -338,12 +349,12 @@ in {
     ghc981 = callPackage ../development/compilers/ghc/9.8.1.nix {
       bootPkgs =
         # For GHC 9.6 no armv7l bindists are available.
-        if stdenv.hostPlatform.isAarch32 then
-          packages.ghc963
-        else if stdenv.hostPlatform.isPower64 && stdenv.hostPlatform.isLittleEndian then
-          packages.ghc963
+        if stdenv.buildPlatform.isAarch32 then
+          bb.packages.ghc963
+        else if stdenv.buildPlatform.isPower64 && stdenv.buildPlatform.isLittleEndian then
+          bb.packages.ghc963
         else
-          packages.ghc963Binary;
+          bb.packages.ghc963Binary;
       inherit (buildPackages.python3Packages) sphinx;
       # Need to use apple's patched xattr until
       # https://github.com/xattr/xattr/issues/44 and
@@ -356,12 +367,12 @@ in {
     ghc982 = callPackage ../development/compilers/ghc/9.8.2.nix {
       bootPkgs =
         # For GHC 9.6 no armv7l bindists are available.
-        if stdenv.hostPlatform.isAarch32 then
-          packages.ghc963
-        else if stdenv.hostPlatform.isPower64 && stdenv.hostPlatform.isLittleEndian then
-          packages.ghc963
+        if stdenv.buildPlatform.isAarch32 then
+          bb.packages.ghc963
+        else if stdenv.buildPlatform.isPower64 && stdenv.buildPlatform.isLittleEndian then
+          bb.packages.ghc963
         else
-          packages.ghc963Binary;
+          bb.packages.ghc963Binary;
       inherit (buildPackages.python3Packages) sphinx;
       # Need to use apple's patched xattr until
       # https://github.com/xattr/xattr/issues/44 and
@@ -371,23 +382,41 @@ in {
       buildTargetLlvmPackages = pkgsBuildTarget.llvmPackages_15;
       llvmPackages = pkgs.llvmPackages_15;
     };
-    ghc98 = compiler.ghc982;
+    ghc983 = callPackage ../development/compilers/ghc/9.8.3.nix {
+      bootPkgs =
+        # For GHC 9.6 no armv7l bindists are available.
+        if stdenv.buildPlatform.isAarch32 then
+          bb.packages.ghc963
+        else if stdenv.buildPlatform.isPower64 && stdenv.buildPlatform.isLittleEndian then
+          bb.packages.ghc963
+        else
+          bb.packages.ghc963Binary;
+      inherit (buildPackages.python3Packages) sphinx;
+      # Need to use apple's patched xattr until
+      # https://github.com/xattr/xattr/issues/44 and
+      # https://github.com/xattr/xattr/issues/55 are solved.
+      inherit (buildPackages.darwin) xattr autoSignDarwinBinariesHook;
+      # Support range >= 11 && < 16
+      buildTargetLlvmPackages = pkgsBuildTarget.llvmPackages_15;
+      llvmPackages = pkgs.llvmPackages_15;
+    };
+    ghc98 = compiler.ghc982; # HLS doesn't work yet with 9.8.3
     ghc9101 = callPackage ../development/compilers/ghc/9.10.1.nix {
       bootPkgs =
         # For GHC 9.6 no armv7l bindists are available.
-        if stdenv.hostPlatform.isAarch32 then
-          packages.ghc963
-        else if stdenv.hostPlatform.isPower64 && stdenv.hostPlatform.isLittleEndian then
-          packages.ghc963
-        else if stdenv.hostPlatform.isDarwin then
+        if stdenv.buildPlatform.isAarch32 then
+          bb.packages.ghc963
+        else if stdenv.buildPlatform.isPower64 && stdenv.buildPlatform.isLittleEndian then
+          bb.packages.ghc963
+        else if stdenv.buildPlatform.isDarwin then
           # it seems like the GHC 9.6.* bindists are built with a different
           # toolchain than we are using (which I'm guessing from the fact
           # that 9.6.4 bindists pass linker flags our ld doesn't support).
           # With both 9.6.3 and 9.6.4 binary it is impossible to link against
           # the clock package (probably a hsc2hs problem).
-          packages.ghc963
+          bb.packages.ghc963
         else
-          packages.ghc963Binary;
+          bb.packages.ghc963Binary;
       inherit (buildPackages.python3Packages) sphinx;
       # Need to use apple's patched xattr until
       # https://github.com/xattr/xattr/issues/44 and
@@ -401,25 +430,25 @@ in {
     ghcHEAD = callPackage ../development/compilers/ghc/head.nix {
       bootPkgs =
         # For GHC 9.6 no armv7l bindists are available.
-        if stdenv.hostPlatform.isAarch32 then
-          packages.ghc963
-        else if stdenv.hostPlatform.isPower64 && stdenv.hostPlatform.isLittleEndian then
-          packages.ghc963
+        if stdenv.buildPlatform.isAarch32 then
+          bb.packages.ghc963
+        else if stdenv.buildPlatform.isPower64 && stdenv.buildPlatform.isLittleEndian then
+          bb.packages.ghc963
         else
-          packages.ghc963Binary;
+          bb.packages.ghc963Binary;
       inherit (buildPackages.python3Packages) sphinx;
       # Need to use apple's patched xattr until
       # https://github.com/xattr/xattr/issues/44 and
       # https://github.com/xattr/xattr/issues/55 are solved.
       inherit (buildPackages.darwin) xattr autoSignDarwinBinariesHook;
       # 2023-01-15: Support range >= 11 && < 16
-      buildTargetLlvmPackages = pkgsBuildTarget.llvmPackages_15;
-      llvmPackages = pkgs.llvmPackages_15;
+      buildTargetLlvmPackages = pkgsBuildTarget.llvmPackages_18;
+      llvmPackages = pkgs.llvmPackages_18;
     };
 
     ghcjs = compiler.ghcjs810;
     ghcjs810 = callPackage ../development/compilers/ghcjs/8.10 {
-      bootPkgs = packages.ghc810;
+      bootPkgs = bb.packages.ghc810;
       ghcjsSrcJson = ../development/compilers/ghcjs/8.10/git.json;
       stage0 = ../development/compilers/ghcjs/8.10/stage0.nix;
     };
@@ -560,7 +589,12 @@ in {
       ghc = bh.compiler.ghc982;
       compilerConfig = callPackage ../development/haskell-modules/configuration-ghc-9.8.x.nix { };
     };
-    ghc98 = packages.ghc982;
+    ghc983 = callPackage ../development/haskell-modules {
+      buildHaskellPackages = bh.packages.ghc983;
+      ghc = bh.compiler.ghc983;
+      compilerConfig = callPackage ../development/haskell-modules/configuration-ghc-9.8.x.nix { };
+    };
+    ghc98 = packages.ghc982; # HLS doesn't work yet with 9.8.3
     ghc9101 = callPackage ../development/haskell-modules {
       buildHaskellPackages = bh.packages.ghc9101;
       ghc = bh.compiler.ghc9101;