about summary refs log tree commit diff
path: root/pkgs
diff options
context:
space:
mode:
authorsternenseemann <sternenseemann@systemli.org>2023-10-21 12:35:29 +0200
committersternenseemann <sternenseemann@systemli.org>2023-11-06 15:26:58 +0100
commit2ec6f635344b634beb6b58137a78df83ab18f95e (patch)
tree48166f604881fd3c026114c690a73e975a19b2de /pkgs
parentfd8a8c9160438e002bf471fe2be3411559836060 (diff)
downloadnixlib-2ec6f635344b634beb6b58137a78df83ab18f95e.tar
nixlib-2ec6f635344b634beb6b58137a78df83ab18f95e.tar.gz
nixlib-2ec6f635344b634beb6b58137a78df83ab18f95e.tar.bz2
nixlib-2ec6f635344b634beb6b58137a78df83ab18f95e.tar.lz
nixlib-2ec6f635344b634beb6b58137a78df83ab18f95e.tar.xz
nixlib-2ec6f635344b634beb6b58137a78df83ab18f95e.tar.zst
nixlib-2ec6f635344b634beb6b58137a78df83ab18f95e.zip
haskell.compiler.ghcHEAD: 9.7.20230527 -> 9.9.20231014
Diffstat (limited to 'pkgs')
-rw-r--r--pkgs/development/compilers/ghc/common-hadrian.nix2
-rw-r--r--pkgs/development/compilers/ghc/head.nix6
-rw-r--r--pkgs/development/haskell-modules/configuration-ghc-9.10.x.nix52
-rw-r--r--pkgs/development/haskell-modules/configuration-ghc-9.8.x.nix7
-rw-r--r--pkgs/development/tools/haskell/hadrian/ghc-platform.nix16
-rw-r--r--pkgs/development/tools/haskell/hadrian/ghc-toolchain.nix19
-rw-r--r--pkgs/development/tools/haskell/hadrian/hadrian.nix (renamed from pkgs/development/tools/haskell/hadrian/default.nix)29
-rw-r--r--pkgs/development/tools/haskell/hadrian/make-hadrian.nix59
-rw-r--r--pkgs/top-level/haskell-packages.nix17
9 files changed, 172 insertions, 35 deletions
diff --git a/pkgs/development/compilers/ghc/common-hadrian.nix b/pkgs/development/compilers/ghc/common-hadrian.nix
index e876c4be0af7..d2d6dade497e 100644
--- a/pkgs/development/compilers/ghc/common-hadrian.nix
+++ b/pkgs/development/compilers/ghc/common-hadrian.nix
@@ -150,7 +150,7 @@
 
   # GHC's build system hadrian built from the GHC-to-build's source tree
   # using our bootstrap GHC.
-, hadrian ? bootPkgs.callPackage ../../tools/haskell/hadrian {
+, hadrian ? import ../../tools/haskell/hadrian/make-hadrian.nix { inherit bootPkgs lib; } {
     ghcSrc = ghcSrc;
     ghcVersion = version;
     userSettings = hadrianUserSettings;
diff --git a/pkgs/development/compilers/ghc/head.nix b/pkgs/development/compilers/ghc/head.nix
index 951b708381f1..6b8d657f34ec 100644
--- a/pkgs/development/compilers/ghc/head.nix
+++ b/pkgs/development/compilers/ghc/head.nix
@@ -1,5 +1,5 @@
 import ./common-hadrian.nix {
-  version = "9.7.20230527";
-  rev = "69fdbece5f6ca0a718bb9f1fef7b0ab57cf6b664";
-  sha256 = "13rf1d27wdich0kmbds55by9vj3wz0v9clba9p8qpwz7x7wpcjz2";
+  version = "9.9.20231014";
+  rev = "13d3c613c3c1e4942c698449bdf58a6a13b76695";
+  sha256 = "13xp4ijnym2qbw2qbxkvfb79l7034vrcm9j2j9kirbhjxzdshvx9";
 }
diff --git a/pkgs/development/haskell-modules/configuration-ghc-9.10.x.nix b/pkgs/development/haskell-modules/configuration-ghc-9.10.x.nix
new file mode 100644
index 000000000000..99f48333323c
--- /dev/null
+++ b/pkgs/development/haskell-modules/configuration-ghc-9.10.x.nix
@@ -0,0 +1,52 @@
+{ pkgs, haskellLib }:
+
+let
+  inherit (pkgs) lib;
+in
+
+self: super: {
+  llvmPackages = lib.dontRecurseIntoAttrs self.ghc.llvmPackages;
+
+  # Disable GHC core libraries
+  array = null;
+  base = null;
+  binary = null;
+  bytestring = null;
+  Cabal = null;
+  Cabal-syntax = null;
+  containers = null;
+  deepseq = null;
+  directory = null;
+  exceptions = null;
+  filepath = null;
+  ghc-bignum = null;
+  ghc-boot = null;
+  ghc-boot-th = null;
+  ghc-compact = null;
+  ghc-experimental = null;
+  ghc-heap = null;
+  ghc-internal = null;
+  ghc-platform = null;
+  ghc-prim = null;
+  ghc-toolchain = null;
+  ghci = null;
+  haskeline = null;
+  hpc = null;
+  integer-gmp = null;
+  mtl = null;
+  parsec = null;
+  pretty = null;
+  process = null;
+  rts = null;
+  semaphore-compat = null;
+  stm = null;
+  system-cxx-std-lib = null;
+  template-haskell = null;
+  # GHC only builds terminfo if it is a native compiler
+  terminfo = if pkgs.stdenv.hostPlatform == pkgs.stdenv.buildPlatform then null else self.terminfo_0_4_1_6;
+  text = null;
+  time = null;
+  transformers = null;
+  unix = null;
+  xhtml = null;
+}
diff --git a/pkgs/development/haskell-modules/configuration-ghc-9.8.x.nix b/pkgs/development/haskell-modules/configuration-ghc-9.8.x.nix
index 4588933abc13..cab81349733e 100644
--- a/pkgs/development/haskell-modules/configuration-ghc-9.8.x.nix
+++ b/pkgs/development/haskell-modules/configuration-ghc-9.8.x.nix
@@ -1,10 +1,3 @@
-##
-## Caveat: a copy of configuration-ghc-8.6.x.nix with minor changes:
-##
-##  1. "8.7" strings
-##  2. llvm 6
-##  3. disabled library update: parallel
-##
 { pkgs, haskellLib }:
 
 with haskellLib;
diff --git a/pkgs/development/tools/haskell/hadrian/ghc-platform.nix b/pkgs/development/tools/haskell/hadrian/ghc-platform.nix
new file mode 100644
index 000000000000..3b1b17fba2c7
--- /dev/null
+++ b/pkgs/development/tools/haskell/hadrian/ghc-platform.nix
@@ -0,0 +1,16 @@
+{ mkDerivation, base, lib
+  # GHC source tree to build ghc-toolchain from
+, ghcSrc
+, ghcVersion
+}:
+mkDerivation {
+  pname = "ghc-platform";
+  version = ghcVersion;
+  src = ghcSrc;
+  postUnpack = ''
+    sourceRoot="$sourceRoot/libraries/ghc-platform"
+  '';
+  libraryHaskellDepends = [ base ];
+  description = "Platform information used by GHC and friends";
+  license = lib.licenses.bsd3;
+}
diff --git a/pkgs/development/tools/haskell/hadrian/ghc-toolchain.nix b/pkgs/development/tools/haskell/hadrian/ghc-toolchain.nix
new file mode 100644
index 000000000000..035fee7aca80
--- /dev/null
+++ b/pkgs/development/tools/haskell/hadrian/ghc-toolchain.nix
@@ -0,0 +1,19 @@
+{ mkDerivation, base, directory, filepath, ghc-platform, lib
+, process, text, transformers
+  # GHC source tree to build ghc-toolchain from
+, ghcVersion
+, ghcSrc
+}:
+mkDerivation {
+  pname = "ghc-toolchain";
+  version = ghcVersion;
+  src = ghcSrc;
+  postUnpack = ''
+    sourceRoot="$sourceRoot/utils/ghc-toolchain"
+  '';
+  libraryHaskellDepends = [
+    base directory filepath ghc-platform process text transformers
+  ];
+  description = "Utility for managing GHC target toolchains";
+  license = lib.licenses.bsd3;
+}
diff --git a/pkgs/development/tools/haskell/hadrian/default.nix b/pkgs/development/tools/haskell/hadrian/hadrian.nix
index 1801d63cf8b9..1be21d6f4519 100644
--- a/pkgs/development/tools/haskell/hadrian/default.nix
+++ b/pkgs/development/tools/haskell/hadrian/hadrian.nix
@@ -1,20 +1,19 @@
-{ # GHC source tree to build hadrian from
-  ghcSrc ? null, ghcVersion ? null
-, mkDerivation, base, bytestring, Cabal, containers, directory
+# See also ./make-hadria.nix
+{ mkDerivation, base, bytestring, Cabal, containers, directory
 , extra, filepath, lib, mtl, parsec, shake, text, transformers
 , unordered-containers, cryptohash-sha256, base16-bytestring
-, userSettings ? null
-# Whether to pass --hyperlinked-source to haddock or not. This is a custom
-# workaround as we wait for this to be configurable via userSettings or similar.
-# https://gitlab.haskell.org/ghc/ghc/-/issues/23625
-, enableHyperlinkedSource ? true
 , writeText
+  # Dependencies that are not on Hackage and only used in certain Hadrian versions
+, ghc-platform ? null
+, ghc-toolchain ? null
+  # GHC source tree to build hadrian from
+, ghcSrc
+, ghcVersion
+  # Customization
+, userSettings ? null
+, enableHyperlinkedSource
 }:
 
-if ghcSrc == null || ghcVersion == null
-then throw "hadrian: need to specify ghcSrc and ghcVersion arguments manually"
-else
-
 mkDerivation {
   pname = "hadrian";
   version = ghcVersion;
@@ -44,7 +43,13 @@ mkDerivation {
     parsec shake text transformers unordered-containers
   ] ++ lib.optionals (lib.versionAtLeast ghcVersion "9.7") [
     cryptohash-sha256 base16-bytestring
+  ] ++ lib.optionals (lib.versionAtLeast ghcVersion "9.9") [
+    ghc-platform ghc-toolchain
   ];
+  passthru = {
+    # Expose »private« dependencies if any
+    inherit ghc-platform ghc-toolchain;
+  };
   description = "GHC build system";
   license = lib.licenses.bsd3;
 }
diff --git a/pkgs/development/tools/haskell/hadrian/make-hadrian.nix b/pkgs/development/tools/haskell/hadrian/make-hadrian.nix
new file mode 100644
index 000000000000..6aa30cb9e60c
--- /dev/null
+++ b/pkgs/development/tools/haskell/hadrian/make-hadrian.nix
@@ -0,0 +1,59 @@
+# Hadrian is the build system used to (exclusively) build GHC. It can
+# (theoretically) be used starting with GHC 9.4 and is required since 9.6. It is
+# developed in the GHC source tree and specific to the GHC version it is released
+# with, i.e. Hadrian always needs to be built from the same GHC source tree as
+# the GHC we want to build.
+#
+# This fact makes it impossible to integrate Hadrian into our Haskell package
+# sets which are also used to bootstrap GHC, since a package set can bootstrap
+# multiple GHC versions (usually two major versions). A bootstrap set would need
+# knowledge of the GHC it would eventually bootstrap which would make the logic
+# unnecessarily complicated.
+#
+# Luckily Hadrian is, while annoying to bootstrap, relatively simple. Specifically
+# all it requires to build is (relative to the GHC we are trying to build) a
+# build->build GHC and build->build Haskell packages. We can get all of this
+# from bootPkgs which is already passed to the GHC expression.
+#
+# The solution is the following: The GHC expression passes its source tree and
+# version along with some parameters to this function (./make-hadrian.nix)
+# which acts as a common expression builder for all Hadrian version as well as
+# related packages that are managed in the GHC source tree. Its main job is to
+# expose all possible compile time customization in a common interface and
+# take care of all differences between Hadrian versions.
+{ bootPkgs
+, lib
+}:
+
+{ # GHC source tree and version to build hadrian & friends from.
+  # These are passed on to the actual package expressions.
+  ghcSrc
+, ghcVersion
+  # Contents of a non-default UserSettings.hs to use when building hadrian, if any.
+  # Should be a string or null.
+, userSettings ? null
+  # Whether to pass --hyperlinked-source to haddock or not. This is a custom
+  # workaround as we wait for this to be configurable via userSettings or similar.
+  # https://gitlab.haskell.org/ghc/ghc/-/issues/23625
+, enableHyperlinkedSource ? false
+}:
+
+let
+  callPackage' = f: args: bootPkgs.callPackage f ({
+    inherit ghcSrc ghcVersion;
+  } // args);
+
+  ghc-platform = callPackage' ./ghc-platform.nix { };
+  ghc-toolchain = callPackage' ./ghc-toolchain.nix {
+    inherit ghc-platform;
+  };
+in
+
+callPackage' ./hadrian.nix ({
+  inherit userSettings enableHyperlinkedSource;
+} // lib.optionalAttrs (lib.versionAtLeast ghcVersion "9.9") {
+  # Starting with GHC 9.9 development, additional in tree packages are required
+  # to build hadrian. (Hackage-released conditional dependencies are handled
+  # in ./hadrian.nix without requiring intervention here.)
+  inherit ghc-platform ghc-toolchain;
+})
diff --git a/pkgs/top-level/haskell-packages.nix b/pkgs/top-level/haskell-packages.nix
index 6b129e6aca01..0b970cb44f04 100644
--- a/pkgs/top-level/haskell-packages.nix
+++ b/pkgs/top-level/haskell-packages.nix
@@ -415,22 +415,15 @@ in {
     };
     ghc98 = compiler.ghc981;
     ghcHEAD = callPackage ../development/compilers/ghc/head.nix {
-      bootPkgs =
-        # For GHC 9.2 no armv7l bindists are available.
-        if stdenv.hostPlatform.isAarch32 then
-          packages.ghc924
-        else if stdenv.hostPlatform.isPower64 && stdenv.hostPlatform.isLittleEndian then
-          packages.ghc924
-        else
-          packages.ghc924Binary;
+      bootPkgs = packages.ghc963;
       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 >= 10 && < 15
-      buildTargetLlvmPackages = pkgsBuildTarget.llvmPackages_14;
-      llvmPackages = pkgs.llvmPackages_14;
+      # 2023-01-15: Support range >= 11 && < 16
+      buildTargetLlvmPackages = pkgsBuildTarget.llvmPackages_15;
+      llvmPackages = pkgs.llvmPackages_15;
     };
 
     ghcjs = compiler.ghcjs810;
@@ -586,7 +579,7 @@ in {
     ghcHEAD = callPackage ../development/haskell-modules {
       buildHaskellPackages = bh.packages.ghcHEAD;
       ghc = bh.compiler.ghcHEAD;
-      compilerConfig = callPackage ../development/haskell-modules/configuration-ghc-9.8.x.nix { };
+      compilerConfig = callPackage ../development/haskell-modules/configuration-ghc-9.10.x.nix { };
     };
 
     ghcjs = packages.ghcjs810;