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.
This commit is contained in:
Matt McHenry
2026-07-12 14:55:42 -04:00
parent 2e5f6016ec
commit bab9648f11
7 changed files with 83 additions and 69 deletions

View File

@@ -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:

View File

@@ -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 { });
};
}

View File

@@ -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

View File

@@ -0,0 +1,30 @@
commit d42c9fb8023dd00b0cd17d1de9bdbf492f2d7551
Author: Matt McHenry <github@matt.mchenryfamily.org>
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 =

View File

@@ -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";
}

View File

@@ -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