about summary refs log tree commit diff
path: root/nixpkgs/pkgs/development/compilers/ghc/common-hadrian.nix
diff options
context:
space:
mode:
Diffstat (limited to 'nixpkgs/pkgs/development/compilers/ghc/common-hadrian.nix')
-rw-r--r--nixpkgs/pkgs/development/compilers/ghc/common-hadrian.nix23
1 files changed, 17 insertions, 6 deletions
diff --git a/nixpkgs/pkgs/development/compilers/ghc/common-hadrian.nix b/nixpkgs/pkgs/development/compilers/ghc/common-hadrian.nix
index 8bc9a5835177..f4d2a279a678 100644
--- a/nixpkgs/pkgs/development/compilers/ghc/common-hadrian.nix
+++ b/nixpkgs/pkgs/development/compilers/ghc/common-hadrian.nix
@@ -162,13 +162,11 @@
   }
 
 , #  Whether to build sphinx documentation.
+  # TODO(@sternenseemann): Hadrian ignores the --docs flag if finalStage = Stage1
   enableDocs ? (
-    # Docs disabled for musl and cross because it's a large task to keep
-    # all `sphinx` dependencies building in those environments.
-    # `sphinx` pulls in among others:
-    # Ruby, Python, Perl, Rust, OpenGL, Xorg, gtk, LLVM.
-    (stdenv.targetPlatform == stdenv.hostPlatform)
-    && !stdenv.hostPlatform.isMusl
+    # Docs disabled if we are building on musl because it's a large task to keep
+    # all `sphinx` dependencies building in this environment.
+    !stdenv.buildPlatform.isMusl
   )
 
 , # Whether to disable the large address space allocator
@@ -271,7 +269,16 @@ stdenv.mkDerivation ({
     (if lib.versionAtLeast version "9.8"
       then ./docs-sphinx-7-ghc98.patch
       else ./docs-sphinx-7.patch )
+  ] ++ lib.optionals (stdenv.targetPlatform.isDarwin && stdenv.targetPlatform.isAarch64) [
+    # Prevent the paths module from emitting symbols that we don't use
+    # when building with separate outputs.
+    #
+    # These cause problems as they're not eliminated by GHC's dead code
+    # elimination on aarch64-darwin. (see
+    # https://github.com/NixOS/nixpkgs/issues/140774 for details).
+    ./Cabal-at-least-3.6-paths-fix-cycle-aarch64-darwin.patch
   ];
+
   postPatch = ''
     patchShebangs --build .
   '';
@@ -507,6 +514,10 @@ stdenv.mkDerivation ({
 
     # Expose hadrian used for bootstrapping, for debugging purposes
     inherit hadrian;
+
+    # TODO(@sternenseemann): there's no stage0:exe:haddock target by default,
+    # so haddock isn't available for GHC cross-compilers. Can we fix that?
+    hasHaddock = stdenv.hostPlatform == stdenv.targetPlatform;
   };
 
   meta = {