From d3af908be6e79ef83e42d1ffb07c91c998179d6d Mon Sep 17 00:00:00 2001 From: sternenseemann Date: Mon, 2 Jun 2025 15:41:08 +0200 Subject: [PATCH] elmPackages.elm-instrument: build using GHC 9.4 As Emily has pointed out, elm-instrument builds with GHC 9.4 without any modifications. Later versions of GHC won't work due to the pinned indents package version which is affected by a breaking change in some core package. --- .../elm/packages/ghc8_10/default.nix | 42 ------------------ .../compilers/elm/packages/ghc9_4/default.nix | 43 +++++++++++++++++++ .../elm-instrument/default.nix | 0 .../{ghc8_10 => ghc9_4}/indents/default.nix | 0 4 files changed, 43 insertions(+), 42 deletions(-) rename pkgs/development/compilers/elm/packages/{ghc8_10 => ghc9_4}/elm-instrument/default.nix (100%) rename pkgs/development/compilers/elm/packages/{ghc8_10 => ghc9_4}/indents/default.nix (100%) diff --git a/pkgs/development/compilers/elm/packages/ghc8_10/default.nix b/pkgs/development/compilers/elm/packages/ghc8_10/default.nix index 223e389dd501..279b9bf07ef9 100644 --- a/pkgs/development/compilers/elm/packages/ghc8_10/default.nix +++ b/pkgs/development/compilers/elm/packages/ghc8_10/default.nix @@ -29,55 +29,13 @@ pkgs.haskell.packages.ghc810.override { maintainers = [ lib.maintainers.turbomack ]; }) (self.callPackage ./elmi-to-json { }) ); - - elm-instrument = justStaticExecutables ( - overrideCabal (drv: { - version = "unstable-2020-03-16"; - src = pkgs.fetchgit { - url = "https://github.com/zwilias/elm-instrument"; - sha256 = "167d7l2547zxdj7i60r6vazznd9ichwc0bqckh3vrh46glkz06jv"; - rev = "63e15bb5ec5f812e248e61b6944189fa4a0aee4e"; - fetchSubmodules = true; - }; - patches = [ - # Update code after breaking change in optparse-applicative - # https://github.com/zwilias/elm-instrument/pull/5 - (pkgs.fetchpatch { - name = "update-optparse-applicative.patch"; - url = "https://github.com/mdevlamynck/elm-instrument/commit/c548709d4818aeef315528e842eaf4c5b34b59b4.patch"; - sha256 = "0ln7ik09n3r3hk7jmwwm46kz660mvxfa71120rkbbaib2falfhsc"; - }) - ]; - - prePatch = '' - sed "s/desc <-.*/let desc = \"${drv.version}\"/g" Setup.hs --in-place - ''; - jailbreak = true; - # Tests are failing because of missing instances for Eq and Show type classes - doCheck = false; - - description = "Instrument Elm code as a preprocessing step for elm-coverage"; - homepage = "https://github.com/zwilias/elm-instrument"; - license = lib.licenses.bsd3; - maintainers = [ lib.maintainers.turbomack ]; - }) (self.callPackage ./elm-instrument { }) - ); }; in elmPkgs // { inherit elmPkgs; - # We need attoparsec < 0.14 to build elm for now - attoparsec = self.attoparsec_0_13_2_5; - # aeson 2.0.3.0 does not build with attoparsec_0_13_2_5 aeson = doJailbreak self.aeson_1_5_6_0; - - # elm-instrument needs this - indents = self.callPackage ./indents { }; - - # elm-instrument's tests depend on an old version of elm-format, but we set doCheck to false for other reasons above - elm-format = null; }; } diff --git a/pkgs/development/compilers/elm/packages/ghc9_4/default.nix b/pkgs/development/compilers/elm/packages/ghc9_4/default.nix index 2f44db00458e..20dd4ada7e54 100644 --- a/pkgs/development/compilers/elm/packages/ghc9_4/default.nix +++ b/pkgs/development/compilers/elm/packages/ghc9_4/default.nix @@ -33,6 +33,46 @@ pkgs.haskell.packages.ghc94.override { ]; }) (self.callPackage ./elm-format/elm-format.nix { }) ); + + elm-instrument = justStaticExecutables ( + overrideCabal + (drv: { + version = "unstable-2020-03-16"; + src = pkgs.fetchgit { + url = "https://github.com/zwilias/elm-instrument"; + sha256 = "167d7l2547zxdj7i60r6vazznd9ichwc0bqckh3vrh46glkz06jv"; + rev = "63e15bb5ec5f812e248e61b6944189fa4a0aee4e"; + fetchSubmodules = true; + }; + patches = [ + # Update code after breaking change in optparse-applicative + # https://github.com/zwilias/elm-instrument/pull/5 + (pkgs.fetchpatch { + name = "update-optparse-applicative.patch"; + url = "https://github.com/mdevlamynck/elm-instrument/commit/c548709d4818aeef315528e842eaf4c5b34b59b4.patch"; + sha256 = "0ln7ik09n3r3hk7jmwwm46kz660mvxfa71120rkbbaib2falfhsc"; + }) + ]; + + prePatch = '' + sed "s/desc <-.*/let desc = \"${drv.version}\"/g" Setup.hs --in-place + ''; + jailbreak = true; + # Tests are failing because of missing instances for Eq and Show type classes + doCheck = false; + + description = "Instrument Elm code as a preprocessing step for elm-coverage"; + homepage = "https://github.com/zwilias/elm-instrument"; + license = lib.licenses.bsd3; + maintainers = [ lib.maintainers.turbomack ]; + }) + ( + self.callPackage ./elm-instrument { + # elm-instrument's tests depend on an old version of elm-format, but we set doCheck to false for other reasons above + elm-format = null; + } + ) + ); }; fixHaddock = overrideCabal (_: { @@ -49,5 +89,8 @@ pkgs.haskell.packages.ghc94.override { elm-format-lib = fixHaddock (doJailbreak (self.callPackage ./elm-format/elm-format-lib.nix { })); elm-format-test-lib = fixHaddock (self.callPackage ./elm-format/elm-format-test-lib.nix { }); elm-format-markdown = fixHaddock (self.callPackage ./elm-format/elm-format-markdown.nix { }); + + # elm-instrument needs this + indents = self.callPackage ./indents { }; }; } diff --git a/pkgs/development/compilers/elm/packages/ghc8_10/elm-instrument/default.nix b/pkgs/development/compilers/elm/packages/ghc9_4/elm-instrument/default.nix similarity index 100% rename from pkgs/development/compilers/elm/packages/ghc8_10/elm-instrument/default.nix rename to pkgs/development/compilers/elm/packages/ghc9_4/elm-instrument/default.nix diff --git a/pkgs/development/compilers/elm/packages/ghc8_10/indents/default.nix b/pkgs/development/compilers/elm/packages/ghc9_4/indents/default.nix similarity index 100% rename from pkgs/development/compilers/elm/packages/ghc8_10/indents/default.nix rename to pkgs/development/compilers/elm/packages/ghc9_4/indents/default.nix