From 2e5f6016ece3c479a5981052ff085094742f0c7c Mon Sep 17 00:00:00 2001 From: Matt McHenry Date: Tue, 7 Jul 2026 20:44:01 -0400 Subject: [PATCH 1/3] elmPackages: clean up the update script * activate the 'errexit' and 'nounset' bash safety nets * fix the path to the root shell.nix (was missing one ../) * also specify that nixpkgs is at that same path * run the formatter on all the nix code generated by the update script * use a pure nix shell, which requires that we add explicit dependencies on: * nix * cacert * nixfmt this version of the script produces the changes to the elm-format expressions: a newer license format and use of the hash of the '0.8.8' signed tag itself rather than the hash of the tagged commit (note the checksum of the src derivation does not change). this is in preparation for the 0.19.2 update --- .../elm/packages/ghc9_8/elm-format/avh4-lib.nix | 4 ++-- .../elm/packages/ghc9_8/elm-format/elm-format-lib.nix | 4 ++-- .../packages/ghc9_8/elm-format/elm-format-markdown.nix | 4 ++-- .../packages/ghc9_8/elm-format/elm-format-test-lib.nix | 4 ++-- .../elm/packages/ghc9_8/elm-format/elm-format.nix | 4 ++-- pkgs/development/compilers/elm/update.sh | 9 ++++++++- 6 files changed, 18 insertions(+), 11 deletions(-) diff --git a/pkgs/development/compilers/elm/packages/ghc9_8/elm-format/avh4-lib.nix b/pkgs/development/compilers/elm/packages/ghc9_8/elm-format/avh4-lib.nix index ac2963015b39..397930f6ebb7 100644 --- a/pkgs/development/compilers/elm/packages/ghc9_8/elm-format/avh4-lib.nix +++ b/pkgs/development/compilers/elm/packages/ghc9_8/elm-format/avh4-lib.nix @@ -22,7 +22,7 @@ mkDerivation { src = fetchgit { url = "https://github.com/avh4/elm-format"; sha256 = "13i1wgva6p9zsx1a7sfb3skc0rv187isb920chkhljyh48c12k8l"; - rev = "d07fddc8c0eef412dba07be4ab8768d6abcca796"; + rev = "4c5bfea5f47b38c1fd7ffa431c51c328a3ae5ba6"; fetchSubmodules = true; }; postUnpack = "sourceRoot+=/avh4-lib; echo source root reset to $sourceRoot"; @@ -55,5 +55,5 @@ mkDerivation { testToolDepends = [ tasty-discover ]; doHaddock = false; description = "Common code for haskell projects"; - license = lib.licenses.bsd3; + license = lib.meta.getLicenseFromSpdxId "BSD-3-Clause"; } diff --git a/pkgs/development/compilers/elm/packages/ghc9_8/elm-format/elm-format-lib.nix b/pkgs/development/compilers/elm/packages/ghc9_8/elm-format/elm-format-lib.nix index 1431976b603a..a87d90799593 100644 --- a/pkgs/development/compilers/elm/packages/ghc9_8/elm-format/elm-format-lib.nix +++ b/pkgs/development/compilers/elm/packages/ghc9_8/elm-format/elm-format-lib.nix @@ -28,7 +28,7 @@ mkDerivation { src = fetchgit { url = "https://github.com/avh4/elm-format"; sha256 = "13i1wgva6p9zsx1a7sfb3skc0rv187isb920chkhljyh48c12k8l"; - rev = "d07fddc8c0eef412dba07be4ab8768d6abcca796"; + rev = "4c5bfea5f47b38c1fd7ffa431c51c328a3ae5ba6"; fetchSubmodules = true; }; postUnpack = "sourceRoot+=/elm-format-lib; echo source root reset to $sourceRoot"; @@ -69,5 +69,5 @@ mkDerivation { testToolDepends = [ tasty-discover ]; doHaddock = false; description = "Common code used by elm-format and elm-refactor"; - license = lib.licenses.bsd3; + license = lib.meta.getLicenseFromSpdxId "BSD-3-Clause"; } diff --git a/pkgs/development/compilers/elm/packages/ghc9_8/elm-format/elm-format-markdown.nix b/pkgs/development/compilers/elm/packages/ghc9_8/elm-format/elm-format-markdown.nix index 639870aa4671..61e15f7e8334 100644 --- a/pkgs/development/compilers/elm/packages/ghc9_8/elm-format/elm-format-markdown.nix +++ b/pkgs/development/compilers/elm/packages/ghc9_8/elm-format/elm-format-markdown.nix @@ -13,7 +13,7 @@ mkDerivation { src = fetchgit { url = "https://github.com/avh4/elm-format"; sha256 = "13i1wgva6p9zsx1a7sfb3skc0rv187isb920chkhljyh48c12k8l"; - rev = "d07fddc8c0eef412dba07be4ab8768d6abcca796"; + rev = "4c5bfea5f47b38c1fd7ffa431c51c328a3ae5ba6"; fetchSubmodules = true; }; postUnpack = "sourceRoot+=/elm-format-markdown; echo source root reset to $sourceRoot"; @@ -25,5 +25,5 @@ mkDerivation { ]; doHaddock = false; description = "Markdown parsing for Elm documentation comments"; - license = lib.licenses.bsd3; + license = lib.meta.getLicenseFromSpdxId "BSD-3-Clause"; } diff --git a/pkgs/development/compilers/elm/packages/ghc9_8/elm-format/elm-format-test-lib.nix b/pkgs/development/compilers/elm/packages/ghc9_8/elm-format/elm-format-test-lib.nix index 48c86d2e3c37..063a25dcc197 100644 --- a/pkgs/development/compilers/elm/packages/ghc9_8/elm-format/elm-format-test-lib.nix +++ b/pkgs/development/compilers/elm/packages/ghc9_8/elm-format/elm-format-test-lib.nix @@ -23,7 +23,7 @@ mkDerivation { src = fetchgit { url = "https://github.com/avh4/elm-format"; sha256 = "13i1wgva6p9zsx1a7sfb3skc0rv187isb920chkhljyh48c12k8l"; - rev = "d07fddc8c0eef412dba07be4ab8768d6abcca796"; + rev = "4c5bfea5f47b38c1fd7ffa431c51c328a3ae5ba6"; fetchSubmodules = true; }; postUnpack = "sourceRoot+=/elm-format-test-lib; echo source root reset to $sourceRoot"; @@ -58,5 +58,5 @@ mkDerivation { testToolDepends = [ tasty-discover ]; doHaddock = false; description = "Test helpers used by elm-format-tests and elm-refactor-tests"; - license = lib.licenses.bsd3; + license = lib.meta.getLicenseFromSpdxId "BSD-3-Clause"; } diff --git a/pkgs/development/compilers/elm/packages/ghc9_8/elm-format/elm-format.nix b/pkgs/development/compilers/elm/packages/ghc9_8/elm-format/elm-format.nix index 1b50f8d8384a..32ea8955fa65 100644 --- a/pkgs/development/compilers/elm/packages/ghc9_8/elm-format/elm-format.nix +++ b/pkgs/development/compilers/elm/packages/ghc9_8/elm-format/elm-format.nix @@ -26,7 +26,7 @@ mkDerivation { src = fetchgit { url = "https://github.com/avh4/elm-format"; sha256 = "13i1wgva6p9zsx1a7sfb3skc0rv187isb920chkhljyh48c12k8l"; - rev = "d07fddc8c0eef412dba07be4ab8768d6abcca796"; + rev = "4c5bfea5f47b38c1fd7ffa431c51c328a3ae5ba6"; fetchSubmodules = true; }; isLibrary = false; @@ -64,6 +64,6 @@ mkDerivation { doHaddock = false; homepage = "https://elm-lang.org"; description = "A source code formatter for Elm"; - license = lib.licenses.bsd3; + license = lib.meta.getLicenseFromSpdxId "BSD-3-Clause"; mainProgram = "elm-format"; } diff --git a/pkgs/development/compilers/elm/update.sh b/pkgs/development/compilers/elm/update.sh index 5e47110d4a2f..45971062f046 100755 --- a/pkgs/development/compilers/elm/update.sh +++ b/pkgs/development/compilers/elm/update.sh @@ -1,5 +1,9 @@ #!/usr/bin/env nix-shell -#!nix-shell -p cabal2nix elm2nix -i bash ../../.. +#!nix-shell -I nixpkgs=../../../.. +#!nix-shell --pure -p nix cacert cabal2nix elm2nix nixfmt -i bash ../../../.. + +set -o errexit +set -o nounset # Update all cabal packages. for subpath in 'avh4-lib' 'elm-format-lib' 'elm-format-markdown' 'elm-format-test-lib'; do @@ -21,3 +25,6 @@ echo "need to manually copy registry.dat from an existing elm project" pushd "$(nix-build -A elmPackages.elm.src --no-out-link ../../../..)/reactor" elm2nix convert > $OLDPWD/packages/elm-srcs.nix popd + +# cabal2nix, elm2nix, etc. may not respect nixpkgs formatting rules +nixfmt . From bab9648f114253ff920e20ea82ebb822ad559229 Mon Sep 17 00:00:00 2001 From: Matt McHenry Date: Sun, 12 Jul 2026 14:55:42 -0400 Subject: [PATCH 2/3] 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 From 6570906c23501d3db2243f697cc2cc9b8302cda4 Mon Sep 17 00:00:00 2001 From: "R. Ryantm" Date: Mon, 6 Jul 2026 21:26:31 +0000 Subject: [PATCH 3/3] elmPackages.elm-test: 0.19.1-revision17 -> 0.19.2-0 --- .../development/compilers/elm/packages/elm-test/default.nix | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/pkgs/development/compilers/elm/packages/elm-test/default.nix b/pkgs/development/compilers/elm/packages/elm-test/default.nix index e918b5ec0e41..744dfe792984 100644 --- a/pkgs/development/compilers/elm/packages/elm-test/default.nix +++ b/pkgs/development/compilers/elm/packages/elm-test/default.nix @@ -6,16 +6,16 @@ buildNpmPackage rec { pname = "elm-test"; - version = "0.19.1-revision17"; + version = "0.19.2-0"; src = fetchFromGitHub { owner = "rtfeldman"; repo = "node-test-runner"; rev = version; - hash = "sha256-qmzmImTDH7CBFxEDtR+XydegnpuYiZuNF6eJ80I2fwM="; + hash = "sha256-Kta6O4EYeqqEmkRXs0yLzTL47RY8DiyAwszhjWi3xwU="; }; - npmDepsHash = "sha256-Yy53mGzARXRnPDLWnUevbnSCMSch1ecsvROu5C96WBA="; + npmDepsHash = "sha256-J1o5dsjyiDav5KELjFGibYETmJO6j8CmLzP7pg/tncM="; postPatch = '' sed -i '/elm-tooling install/d' package.json