From bab9648f114253ff920e20ea82ebb822ad559229 Mon Sep 17 00:00:00 2001 From: Matt McHenry Date: Sun, 12 Jul 2026 14:55:42 -0400 Subject: [PATCH] elmPackages.elm: 0.19.1 -> 0.19.2 two interesting changes here: first, 0.19.2 needs to be built with GHC 9.8 rather than GHC 9.6. So, we move it and ansi-wl-pprint from packages/ghc9_6/ to packages/ghc9_8/, adding the elmPkgs attributes to packages/ghc9_8/default.nix. however, elm-format does *not* want the older ansi-wl-pprint, so we push its use down inside the 'callPackage ./elm {}' scope. second, we're picking up a newer version of ansi-terminal than upstream uses, which has introduced a couple of new underlining-related constructors. so, we patch in cases for them where necessary. (I was a bit surprised that the existing SingleUnderline and DoubleUnderline cases in the 'isUnderline' function did not both evaluate to 'True', so I'm taking my best guess as to the real intent here; easy enough to fix if we discover these new cases should be 'True'.) we also manually preserve the 'description' attribute in elm/default.nix. (the update script clobbered it.) other than the above, the update script as modified here produced all these changes. --- pkgs/development/compilers/elm/default.nix | 7 +-- .../compilers/elm/packages/ghc9_6/default.nix | 50 ------------------- .../ansi-wl-pprint/default.nix | 0 .../compilers/elm/packages/ghc9_8/default.nix | 44 +++++++++++++++- .../ghc9_8/elm/ansi-terminal-1.1.patch | 30 +++++++++++ .../{ghc9_6 => ghc9_8}/elm/default.nix | 13 ++--- pkgs/development/compilers/elm/update.sh | 8 ++- 7 files changed, 83 insertions(+), 69 deletions(-) delete mode 100644 pkgs/development/compilers/elm/packages/ghc9_6/default.nix rename pkgs/development/compilers/elm/packages/{ghc9_6 => ghc9_8}/ansi-wl-pprint/default.nix (100%) create mode 100644 pkgs/development/compilers/elm/packages/ghc9_8/elm/ansi-terminal-1.1.patch rename pkgs/development/compilers/elm/packages/{ghc9_6 => ghc9_8}/elm/default.nix (83%) diff --git a/pkgs/development/compilers/elm/default.nix b/pkgs/development/compilers/elm/default.nix index dacaf27ca9d0..6bfc64302fa4 100644 --- a/pkgs/development/compilers/elm/default.nix +++ b/pkgs/development/compilers/elm/default.nix @@ -10,10 +10,7 @@ let fetchElmDeps = pkgs.callPackage ./lib/fetchElmDeps.nix { }; # Haskell packages that require ghc 9.8 - hs98Pkgs = import ./packages/ghc9_8 { inherit pkgs lib; }; - - # Haskell packages that require ghc 9.6 - hs96Pkgs = import ./packages/ghc9_6 { + hs98Pkgs = import ./packages/ghc9_8 { inherit pkgs lib @@ -23,7 +20,7 @@ let ; }; - assembleScope = self: basics: (hs98Pkgs self).elmPkgs // (hs96Pkgs self).elmPkgs // basics; + assembleScope = self: basics: (hs98Pkgs self).elmPkgs // basics; in lib.makeScope pkgs.newScope ( self: diff --git a/pkgs/development/compilers/elm/packages/ghc9_6/default.nix b/pkgs/development/compilers/elm/packages/ghc9_6/default.nix deleted file mode 100644 index 14e6af7a25fb..000000000000 --- a/pkgs/development/compilers/elm/packages/ghc9_6/default.nix +++ /dev/null @@ -1,50 +0,0 @@ -{ - pkgs, - lib, - makeWrapper, - nodejs, - fetchElmDeps, -}: - -self: -pkgs.haskell.packages.ghc96.override { - overrides = - self: super: - let - inherit (pkgs.haskell.lib.compose) overrideCabal; - elmPkgs = rec { - elm = overrideCabal (drv: { - # sadly with parallelism most of the time breaks compilation - enableParallelBuilding = false; - preConfigure = fetchElmDeps { - elmPackages = (import ../elm-srcs.nix); - elmVersion = drv.version; - registryDat = ../../registry.dat; - }; - buildTools = drv.buildTools or [ ] ++ [ makeWrapper ]; - postInstall = '' - wrapProgram $out/bin/elm \ - --prefix PATH ':' ${lib.makeBinPath [ nodejs ]} - ''; - - description = "Delightful language for reliable webapps"; - homepage = "https://elm-lang.org/"; - license = lib.licenses.bsd3; - maintainers = with lib.maintainers; [ - turbomack - ]; - }) (self.callPackage ./elm { }); - - inherit fetchElmDeps; - elmVersion = elmPkgs.elm.version; - }; - in - elmPkgs - // { - inherit elmPkgs; - - ansi-wl-pprint = overrideCabal (drv: { - jailbreak = true; - }) (self.callPackage ./ansi-wl-pprint { }); - }; -} diff --git a/pkgs/development/compilers/elm/packages/ghc9_6/ansi-wl-pprint/default.nix b/pkgs/development/compilers/elm/packages/ghc9_8/ansi-wl-pprint/default.nix similarity index 100% rename from pkgs/development/compilers/elm/packages/ghc9_6/ansi-wl-pprint/default.nix rename to pkgs/development/compilers/elm/packages/ghc9_8/ansi-wl-pprint/default.nix diff --git a/pkgs/development/compilers/elm/packages/ghc9_8/default.nix b/pkgs/development/compilers/elm/packages/ghc9_8/default.nix index 8e6078f81876..ece17961d804 100644 --- a/pkgs/development/compilers/elm/packages/ghc9_8/default.nix +++ b/pkgs/development/compilers/elm/packages/ghc9_8/default.nix @@ -1,4 +1,10 @@ -{ pkgs, lib }: +{ + pkgs, + lib, + makeWrapper, + nodejs, + fetchElmDeps, +}: self: pkgs.haskell.packages.ghc98.override { @@ -8,6 +14,39 @@ pkgs.haskell.packages.ghc98.override { inherit (pkgs.haskell.lib.compose) justStaticExecutables overrideCabal; elmPkgs = { + elm = + overrideCabal + (drv: { + # sadly with parallelism most of the time breaks compilation + enableParallelBuilding = false; + preConfigure = fetchElmDeps { + elmPackages = (import ../elm-srcs.nix); + elmVersion = drv.version; + registryDat = ../../registry.dat; + }; + buildTools = drv.buildTools or [ ] ++ [ makeWrapper ]; + postInstall = '' + wrapProgram $out/bin/elm \ + --prefix PATH ':' ${lib.makeBinPath [ nodejs ]} + ''; + + description = "Delightful language for reliable webapps"; + homepage = "https://elm-lang.org/"; + license = lib.licenses.bsd3; + maintainers = with lib.maintainers; [ + turbomack + ]; + }) + ( + self.callPackage ./elm { + # note: only elm itself works with this older version + # elm-format needs the standard newer version + ansi-wl-pprint = overrideCabal (drv: { + jailbreak = true; + }) (self.callPackage ./ansi-wl-pprint { }); + } + ); + # Post-patch override taken from the upstream repository: # https://github.com/avh4/elm-format/blob/e7e5da37716acbfb4954a88128b5cc72b2c911d9/package/nix/generate_derivation.sh elm-format = justStaticExecutables ( @@ -28,6 +67,9 @@ pkgs.haskell.packages.ghc98.override { ]; }) (self.callPackage ./elm-format/elm-format.nix { }) ); + + inherit fetchElmDeps; + elmVersion = elmPkgs.elm.version; }; in elmPkgs diff --git a/pkgs/development/compilers/elm/packages/ghc9_8/elm/ansi-terminal-1.1.patch b/pkgs/development/compilers/elm/packages/ghc9_8/elm/ansi-terminal-1.1.patch new file mode 100644 index 000000000000..c49ef3350909 --- /dev/null +++ b/pkgs/development/compilers/elm/packages/ghc9_8/elm/ansi-terminal-1.1.patch @@ -0,0 +1,30 @@ +commit d42c9fb8023dd00b0cd17d1de9bdbf492f2d7551 +Author: Matt McHenry +Date: Tue Jul 7 22:20:19 2026 + + stub out support for new underlining modes in ansi-terminal 1.1 + +diff --git a/compiler/src/Reporting/Doc.hs b/compiler/src/Reporting/Doc.hs +index ccfb0d19..3ee16900 100644 +--- a/compiler/src/Reporting/Doc.hs ++++ b/compiler/src/Reporting/Doc.hs +@@ -363,6 +363,9 @@ isUnderline underlining = + case underlining of + Ansi.SingleUnderline -> True + Ansi.DoubleUnderline -> False ++ Ansi.CurlyUnderline -> False ++ Ansi.DottedUnderline -> False ++ Ansi.DashedUnderline -> False + Ansi.NoUnderline -> False + + +@@ -372,6 +375,9 @@ toColor layer intensity color = + Ansi.Background -> + Nothing + ++ Ansi.Underlining -> ++ Nothing ++ + Ansi.Foreground -> + let + pick dull vivid = diff --git a/pkgs/development/compilers/elm/packages/ghc9_6/elm/default.nix b/pkgs/development/compilers/elm/packages/ghc9_8/elm/default.nix similarity index 83% rename from pkgs/development/compilers/elm/packages/ghc9_6/elm/default.nix rename to pkgs/development/compilers/elm/packages/ghc9_8/elm/default.nix index 253a9986ac64..5fb29349c02c 100644 --- a/pkgs/development/compilers/elm/packages/ghc9_6/elm/default.nix +++ b/pkgs/development/compilers/elm/packages/ghc9_8/elm/default.nix @@ -9,7 +9,6 @@ directory, edit-distance, fetchgit, - file-embed, filelock, filepath, ghc-prim, @@ -24,7 +23,6 @@ network, parsec, process, - raw-strings-qq, scientific, SHA, snap-core, @@ -38,13 +36,14 @@ }: mkDerivation { pname = "elm"; - version = "0.19.1"; + version = "0.19.2"; src = fetchgit { url = "https://github.com/elm/compiler"; - sha256 = "1h9jhwlv1pqqna5s09vd72arwhhjn0dlhv0w9xx5771x0xryxxg8"; - rev = "2f6dd29258e880dbb7effd57a829a0470d8da48b"; + sha256 = "0npadfvk5gyiifq4095yg7k8cr3hb28drdh07b77nxzwsqanp4s5"; + rev = "48befde196cbcbdf459114e36c02b52c49b58050"; fetchSubmodules = true; }; + patches = [ ./ansi-terminal-1.1.patch ]; isLibrary = false; isExecutable = true; executableHaskellDepends = [ @@ -56,7 +55,6 @@ mkDerivation { containers directory edit-distance - file-embed filelock filepath ghc-prim @@ -70,7 +68,6 @@ mkDerivation { network parsec process - raw-strings-qq scientific SHA snap-core @@ -84,6 +81,6 @@ mkDerivation { ]; homepage = "https://elm-lang.org"; description = "The `elm` command line interface"; - license = lib.licenses.bsd3; + license = lib.meta.getLicenseFromSpdxId "BSD-3-Clause"; mainProgram = "elm"; } diff --git a/pkgs/development/compilers/elm/update.sh b/pkgs/development/compilers/elm/update.sh index 45971062f046..661ff47c8068 100755 --- a/pkgs/development/compilers/elm/update.sh +++ b/pkgs/development/compilers/elm/update.sh @@ -11,13 +11,11 @@ for subpath in 'avh4-lib' 'elm-format-lib' 'elm-format-markdown' 'elm-format-tes --subpath $subpath > packages/ghc9_8/elm-format/${subpath}.nix done cabal2nix --no-haddock 'https://github.com/avh4/elm-format' --revision '0.8.8' > packages/ghc9_8/elm-format/elm-format.nix -cabal2nix 'https://github.com/ekmett/ansi-wl-pprint' --revision 'v0.6.8.1' > packages/ghc9_6/ansi-wl-pprint/default.nix +cabal2nix 'https://github.com/ekmett/ansi-wl-pprint' --revision 'v0.6.8.1' > packages/ghc9_8/ansi-wl-pprint/default.nix -# We're building binaries from commit that npm installer is using since -# November 1st release called 0.19.1-6 in npm registry. +# We're building binaries from commit corresponding to https://github.com/elm/compiler/releases/tag/0.19.2. # These binaries are built with newer ghc version and also support Aarch64 for Linux and Darwin. -# Upstream git tag for 0.19.1 is still pointing to original commit from 2019. -cabal2nix https://github.com/elm/compiler --revision 2f6dd29258e880dbb7effd57a829a0470d8da48b > packages/ghc9_6/elm/default.nix +cabal2nix https://github.com/elm/compiler --revision 48befde196cbcbdf459114e36c02b52c49b58050 > packages/ghc9_8/elm/default.nix echo "need to manually copy registry.dat from an existing elm project" #elm2nix snapshot > registry.dat