From cadb3d1df5cc2a98cc62a98a1622ab13af6fb9eb Mon Sep 17 00:00:00 2001 From: Alexandre Esteves Date: Fri, 14 Jun 2024 20:13:43 +0100 Subject: [PATCH] haskellPackages.ghcjs-dom: build on js backend of ghc 9.8 --- .../haskell-modules/configuration-common.nix | 6 ----- ...-ghcjs.nix => configuration-ghcjs-8.x.nix} | 0 .../configuration-ghcjs-9.x.nix | 22 +++++++++++++++++++ .../configuration-hackage2nix/broken.yaml | 1 - .../configuration-hackage2nix/main.yaml | 2 ++ pkgs/development/haskell-modules/default.nix | 6 ++++- .../haskell-modules/generic-builder.nix | 17 ++++++++------ .../haskell-modules/hackage-packages.nix | 4 ++-- pkgs/top-level/haskell-packages.nix | 2 +- 9 files changed, 42 insertions(+), 18 deletions(-) rename pkgs/development/haskell-modules/{configuration-ghcjs.nix => configuration-ghcjs-8.x.nix} (100%) create mode 100644 pkgs/development/haskell-modules/configuration-ghcjs-9.x.nix diff --git a/pkgs/development/haskell-modules/configuration-common.nix b/pkgs/development/haskell-modules/configuration-common.nix index b73d72d99a3a..3d402d3d1be6 100644 --- a/pkgs/development/haskell-modules/configuration-common.nix +++ b/pkgs/development/haskell-modules/configuration-common.nix @@ -274,12 +274,6 @@ self: super: { sha256 = "1c7knpvxr7p8c159jkyk6w29653z5yzgjjqj11130bbb8mk9qhq7"; }) super.c2hsc; - # Some Hackage packages reference this attribute, which exists only in the - # GHCJS package set. We provide a dummy version here to fix potential - # evaluation errors. - ghcjs-base = null; - ghcjs-prim = null; - ghc-debug-client = doJailbreak super.ghc-debug-client; # Test failure. Tests also disabled in Stackage: diff --git a/pkgs/development/haskell-modules/configuration-ghcjs.nix b/pkgs/development/haskell-modules/configuration-ghcjs-8.x.nix similarity index 100% rename from pkgs/development/haskell-modules/configuration-ghcjs.nix rename to pkgs/development/haskell-modules/configuration-ghcjs-8.x.nix diff --git a/pkgs/development/haskell-modules/configuration-ghcjs-9.x.nix b/pkgs/development/haskell-modules/configuration-ghcjs-9.x.nix new file mode 100644 index 000000000000..3b1f8dc4558e --- /dev/null +++ b/pkgs/development/haskell-modules/configuration-ghcjs-9.x.nix @@ -0,0 +1,22 @@ +{ pkgs, haskellLib }: + +with haskellLib; + +# cabal2nix doesn't properly add dependencies conditional on arch(javascript) +(self: super: { + ghcjs-base = addBuildDepends (with self; [ + aeson + attoparsec + dlist + hashable + primitive + scientific + unordered-containers + vector + ]) super.ghcjs-base; + + ghcjs-dom = addBuildDepend self.ghcjs-dom-javascript super.ghcjs-dom; + ghcjs-dom-javascript = addBuildDepend self.ghcjs-base super.ghcjs-dom-javascript; + jsaddle = addBuildDepend self.ghcjs-base super.jsaddle; + jsaddle-dom = addBuildDepend self.ghcjs-base super.jsaddle-dom; +}) diff --git a/pkgs/development/haskell-modules/configuration-hackage2nix/broken.yaml b/pkgs/development/haskell-modules/configuration-hackage2nix/broken.yaml index 02729804ac97..04a308f33d73 100644 --- a/pkgs/development/haskell-modules/configuration-hackage2nix/broken.yaml +++ b/pkgs/development/haskell-modules/configuration-hackage2nix/broken.yaml @@ -1995,7 +1995,6 @@ broken-packages: - ghc-internal # failure in job https://hydra.nixos.org/build/260723678 at 2024-05-25 - ghcitui # failure in job https://hydra.nixos.org/build/252737339 at 2024-03-16 - ghcjs-base-stub # timeout - - ghcjs-dom-javascript # failure in job https://hydra.nixos.org/build/255688382 at 2024-04-16 - ghcjs-dom-jsffi # failure in job https://hydra.nixos.org/build/233215225 at 2023-09-02 - ghcjs-fetch # timeout - ghcjs-promise # failure in job https://hydra.nixos.org/build/233243985 at 2023-09-02 diff --git a/pkgs/development/haskell-modules/configuration-hackage2nix/main.yaml b/pkgs/development/haskell-modules/configuration-hackage2nix/main.yaml index 93eebf297e8e..1a734a348afa 100644 --- a/pkgs/development/haskell-modules/configuration-hackage2nix/main.yaml +++ b/pkgs/development/haskell-modules/configuration-hackage2nix/main.yaml @@ -152,6 +152,7 @@ package-maintainers: - ghcjs-dom - ghcjs-dom-hello - ghcjs-dom-javascript + - ghcjs-dom-jsaddle - haveibeenpwned - jsaddle - jsaddle-clib @@ -792,6 +793,7 @@ supported-platforms: geomancy: [ platforms.x86 ] # x86 intrinsics geomancy-layout: [ platforms.x86 ] # x86 intrinsics gi-gtkosxapplication: [ platforms.darwin ] + ghcjs-dom-javascript: [ javascript-ghcjs ] gtk-mac-integration: [ platforms.darwin ] gtk3-mac-integration: [ platforms.darwin ] halide-haskell: [ platforms.linux ] diff --git a/pkgs/development/haskell-modules/default.nix b/pkgs/development/haskell-modules/default.nix index 3f8a0bb750c7..73ce1af7735a 100644 --- a/pkgs/development/haskell-modules/default.nix +++ b/pkgs/development/haskell-modules/default.nix @@ -9,6 +9,7 @@ , configurationNix ? import ./configuration-nix.nix , configurationArm ? import ./configuration-arm.nix , configurationDarwin ? import ./configuration-darwin.nix +, configurationJS ? import ./configuration-ghcjs-9.x.nix }: let @@ -26,7 +27,10 @@ let (configurationArm { inherit pkgs haskellLib; }) ] ++ lib.optionals stdenv.hostPlatform.isDarwin [ (configurationDarwin { inherit pkgs haskellLib; }) - ]; + ] ++ lib.optionals stdenv.hostPlatform.isGhcjs [ + (configurationJS { inherit pkgs haskellLib; }) + ] + ; extensions = lib.composeManyExtensions ([ (nonHackagePackages { inherit pkgs haskellLib; }) diff --git a/pkgs/development/haskell-modules/generic-builder.nix b/pkgs/development/haskell-modules/generic-builder.nix index e32bef104de6..6c60efe1bce5 100644 --- a/pkgs/development/haskell-modules/generic-builder.nix +++ b/pkgs/development/haskell-modules/generic-builder.nix @@ -7,6 +7,13 @@ let isCross = stdenv.buildPlatform != stdenv.hostPlatform; + # Note that ghc.isGhcjs != stdenv.hostPlatform.isGhcjs. + # ghc.isGhcjs implies that we are using ghcjs, a project separate from GHC. + # (mere) stdenv.hostPlatform.isGhcjs means that we are using GHC's JavaScript + # backend. The latter is a normal cross compilation backend and needs little + # special accommodation. + outputsJS = ghc.isGhcjs or false || stdenv.hostPlatform.isGhcjs; + # Pass the "wrong" C compiler rather than none at all so packages that just # use the C preproccessor still work, see # https://github.com/haskell/cabal/issues/6466 for details. @@ -19,15 +26,11 @@ let fetchurl removeReferencesTo pkg-config coreutils gnugrep glibcLocales emscripten; + in { pname -# Note that ghc.isGhcjs != stdenv.hostPlatform.isGhcjs. -# ghc.isGhcjs implies that we are using ghcjs, a project separate from GHC. -# (mere) stdenv.hostPlatform.isGhcjs means that we are using GHC's JavaScript -# backend. The latter is a normal cross compilation backend and needs little -# special accommodation. -, dontStrip ? (ghc.isGhcjs or false || stdenv.hostPlatform.isGhcjs) +, dontStrip ? outputsJS , version, revision ? null , sha256 ? null , src ? fetchurl { url = "mirror://hackage/${pname}-${version}.tar.gz"; inherit sha256; } @@ -44,7 +47,7 @@ in , doHaddockQuickjump ? doHoogle , doInstallIntermediates ? false , editedCabalFile ? null -, enableLibraryProfiling ? !(ghc.isGhcjs or false) +, enableLibraryProfiling ? !outputsJS , enableExecutableProfiling ? false , profilingDetail ? "exported-functions" # TODO enable shared libs for cross-compiling diff --git a/pkgs/development/haskell-modules/hackage-packages.nix b/pkgs/development/haskell-modules/hackage-packages.nix index 1b67efe86b38..1c281355e688 100644 --- a/pkgs/development/haskell-modules/hackage-packages.nix +++ b/pkgs/development/haskell-modules/hackage-packages.nix @@ -121427,9 +121427,8 @@ self: { sha256 = "0im7wn7bn43rhkblh0wn9angadbdvywsalfz0adr9pkwv6hvc8qs"; description = "DOM library using JSFFI and GHCJS"; license = lib.licenses.mit; - hydraPlatforms = lib.platforms.none; + platforms = [ "javascript-ghcjs" ]; maintainers = [ lib.maintainers.alexfmpe ]; - broken = true; }) {}; "ghcjs-dom-jsaddle" = callPackage @@ -121442,6 +121441,7 @@ self: { doHaddock = false; description = "DOM library that supports both GHCJS and GHC using jsaddle"; license = lib.licenses.mit; + maintainers = [ lib.maintainers.alexfmpe ]; }) {}; "ghcjs-dom-jsffi" = callPackage diff --git a/pkgs/top-level/haskell-packages.nix b/pkgs/top-level/haskell-packages.nix index 562c4d732824..b924a29f2616 100644 --- a/pkgs/top-level/haskell-packages.nix +++ b/pkgs/top-level/haskell-packages.nix @@ -568,7 +568,7 @@ in { buildHaskellPackages = ghc.bootPkgs; ghc = bh.compiler.ghcjs810; compilerConfig = callPackage ../development/haskell-modules/configuration-ghc-8.10.x.nix { }; - packageSetConfig = callPackage ../development/haskell-modules/configuration-ghcjs.nix { }; + packageSetConfig = callPackage ../development/haskell-modules/configuration-ghcjs-8.x.nix { }; }; # The integer-simple attribute set contains package sets for all the GHC compilers