diff --git a/pkgs/development/compilers/ghc/common-hadrian.nix b/pkgs/development/compilers/ghc/common-hadrian.nix index 60d54e791a60..dd47b146c455 100644 --- a/pkgs/development/compilers/ghc/common-hadrian.nix +++ b/pkgs/development/compilers/ghc/common-hadrian.nix @@ -154,6 +154,8 @@ ghcSrc = ghcSrc; ghcVersion = version; userSettings = hadrianUserSettings; + # Disable haddock generating pretty source listings to stay under 3GB on aarch64-linux + enableHyperlinkedSource = !(stdenv.hostPlatform.isAarch64 && stdenv.hostPlatform.isLinux); } , # Whether to build sphinx documentation. diff --git a/pkgs/development/tools/haskell/hadrian/default.nix b/pkgs/development/tools/haskell/hadrian/default.nix index 5911c34982b0..1801d63cf8b9 100644 --- a/pkgs/development/tools/haskell/hadrian/default.nix +++ b/pkgs/development/tools/haskell/hadrian/default.nix @@ -4,6 +4,10 @@ , 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 }: @@ -18,6 +22,9 @@ mkDerivation { postUnpack = '' sourceRoot="$sourceRoot/hadrian" ''; + patches = lib.optionals (!enableHyperlinkedSource) [ + ./disable-hyperlinked-source.patch + ]; # Overwrite UserSettings.hs with a provided custom one postPatch = lib.optionalString (userSettings != null) '' install -m644 "${writeText "UserSettings.hs" userSettings}" src/UserSettings.hs diff --git a/pkgs/development/tools/haskell/hadrian/disable-hyperlinked-source.patch b/pkgs/development/tools/haskell/hadrian/disable-hyperlinked-source.patch new file mode 100644 index 000000000000..72010f85cddc --- /dev/null +++ b/pkgs/development/tools/haskell/hadrian/disable-hyperlinked-source.patch @@ -0,0 +1,12 @@ +diff --git a/hadrian/src/Settings/Builders/Haddock.hs b/hadrian/src/Settings/Builders/Haddock.hs +index 902b2f85e2..429a441c3b 100644 +--- a/src/Settings/Builders/Haddock.hs ++++ b/src/Settings/Builders/Haddock.hs +@@ -57,7 +57,6 @@ haddockBuilderArgs = mconcat + , arg $ "--odir=" ++ takeDirectory output + , arg $ "--dump-interface=" ++ output + , arg "--html" +- , arg "--hyperlinked-source" + , arg "--hoogle" + , arg "--quickjump" + , arg $ "--title=" ++ pkgName pkg ++ "-" ++ version