From 1eddb04ac9fd76f0183e23b1c00e23b66fd013ac Mon Sep 17 00:00:00 2001 From: sternenseemann Date: Sun, 9 Jul 2023 15:25:40 +0200 Subject: [PATCH] haskell.compiler.{ghc962,ghcHEAD}: no rendered src on aarch64-linux MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This saves just enough space on aarch64-linux so that the hadrian built GHCs are under the 3GB Hydra output limit: | compiler | before | after | Δ | |----------|------------|------------|------------| | ghc962 | 3241234736 | 2810740560 | -430494176 | | ghcHEAD | 3341288328 | 2902760872 | -438527456 | The total output size can be calculated using (don't forget to use aarch64-linux): ``` nix-build -A | xargs nix path-info -s | awk '{ s += $2 }; END { print s }' ``` --- pkgs/development/compilers/ghc/common-hadrian.nix | 2 ++ pkgs/development/tools/haskell/hadrian/default.nix | 7 +++++++ .../haskell/hadrian/disable-hyperlinked-source.patch | 12 ++++++++++++ 3 files changed, 21 insertions(+) create mode 100644 pkgs/development/tools/haskell/hadrian/disable-hyperlinked-source.patch 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