From fde2e98a0116ddba74569d11f281cd87fbdf13ab Mon Sep 17 00:00:00 2001 From: sternenseemann Date: Mon, 11 Apr 2022 01:26:04 +0200 Subject: [PATCH 1/2] haskell.compiler.ghcjs: fix build with aeson 2.0 --- .../compilers/ghcjs/8.10/common-overrides.nix | 35 +++++++++++++++++-- .../compilers/ghcjs/8.10/default.nix | 3 +- 2 files changed, 34 insertions(+), 4 deletions(-) diff --git a/pkgs/development/compilers/ghcjs/8.10/common-overrides.nix b/pkgs/development/compilers/ghcjs/8.10/common-overrides.nix index a83795635b90..e1671d01ffe7 100644 --- a/pkgs/development/compilers/ghcjs/8.10/common-overrides.nix +++ b/pkgs/development/compilers/ghcjs/8.10/common-overrides.nix @@ -1,8 +1,37 @@ -{ haskellLib }: +{ haskellLib, fetchpatch, buildPackages }: -let inherit (haskellLib) addBuildTools appendConfigureFlag dontHaddock doJailbreak; +let inherit (haskellLib) addBuildTools appendConfigureFlag dontHaddock doJailbreak markUnbroken overrideCabal; in self: super: { - ghcjs = doJailbreak (super.ghcjs.overrideScope (self: super: { + ghcjs = overrideCabal (drv: { + # Jailbreak and patch can be dropped after https://github.com/ghcjs/ghcjs/pull/833 + jailbreak = true; + patches = drv.patches or [] ++ [ + (fetchpatch { + name = "ghcjs-aeson-2.0.patch"; + url = "https://github.com/ghcjs/ghcjs/commit/9ef1f92d740e8503d15d91699f57db147f0474cc.patch"; + sha256 = "0cgxcy6b5870bv4kj54n3bzcqinh4gl4w4r78dg43h2mblhkzbnj"; + }) + ]; + }) (super.ghcjs.overrideScope (self: super: { optparse-applicative = self.optparse-applicative_0_15_1_0; + webdriver = overrideCabal (drv: { + patches = drv.patches or [] ++ [ + # Patch for aeson 2.0 which adds a lower bound on it, so we don't apply it globally + # Pending https://github.com/kallisti-dev/hs-webdriver/pull/183 + (fetchpatch { + name = "webdriver-aeson-2.0.patch"; + url = "https://github.com/georgefst/hs-webdriver/commit/90ded63218da17fc0bd9f9b208b0b3f60b135757.patch"; + sha256 = "1xvkk51r2v020xlmci5n1fd1na8raa332lrj7r9f0ijsyfvnqlv0"; + excludes = [ "webdriver.cabal" ]; + }) + ]; + # Fix line endings so patch applies + prePatch = drv.prePatch or "" + '' + find . -name '*.hs' | xargs "${buildPackages.dos2unix}/bin/dos2unix" + ''; + + jailbreak = true; + broken = false; + }) super.webdriver; })); } diff --git a/pkgs/development/compilers/ghcjs/8.10/default.nix b/pkgs/development/compilers/ghcjs/8.10/default.nix index 2fbf7ded9c40..78d757efee3c 100644 --- a/pkgs/development/compilers/ghcjs/8.10/default.nix +++ b/pkgs/development/compilers/ghcjs/8.10/default.nix @@ -2,6 +2,7 @@ , pkgsHostHost , callPackage , fetchgit +, fetchpatch , ghcjsSrcJson ? null , ghcjsSrc ? fetchgit (lib.importJSON ghcjsSrcJson) , bootPkgs @@ -36,7 +37,7 @@ let }) (callPackage ./common-overrides.nix { - inherit haskellLib; + inherit haskellLib fetchpatch buildPackages; }) ghcjsDepOverrides ]); From 7ad0327b599c653cd8eecdae6dcb1eb2ceccc29e Mon Sep 17 00:00:00 2001 From: sternenseemann Date: Mon, 11 Apr 2022 01:36:54 +0200 Subject: [PATCH 2/2] release-haskell.nix: build boot ghcjs on Hydra By telling Hydra where to look explicitly, it can be instrumented to build the boot ghcjs which is only about 300MB. This saves at least some time compiling for users and will also provide some eval CI automatically. --- pkgs/top-level/release-haskell.nix | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/pkgs/top-level/release-haskell.nix b/pkgs/top-level/release-haskell.nix index 4eb8d040a7da..720b4e7fc330 100644 --- a/pkgs/top-level/release-haskell.nix +++ b/pkgs/top-level/release-haskell.nix @@ -129,7 +129,18 @@ let jobs = recursiveUpdateMany [ (mapTestOn { haskellPackages = packagePlatforms pkgs.haskellPackages; - haskell.compiler = packagePlatforms pkgs.haskell.compiler; + haskell.compiler = packagePlatforms pkgs.haskell.compiler // (lib.genAttrs [ + "ghcjs" + "ghcjs810" + ] (ghcjsName: { + # We can't build ghcjs itself, since it exceeds 3GB (Hydra's output limit) due + # to the size of its bundled libs. We can however save users a bit of compile + # time by building the bootstrap ghcjs on Hydra. For this reason, we overwrite + # the ghcjs attributes in haskell.compiler with a reference to the bootstrap + # ghcjs attribute in their bootstrap package set (exposed via passthru) which + # would otherwise be ignored by Hydra. + bootGhcjs = (packagePlatforms pkgs.haskell.compiler.${ghcjsName}.passthru).bootGhcjs; + })); tests.haskell = packagePlatforms pkgs.tests.haskell;