elmPackages.elm-coverage: drop (#415911)

This commit is contained in:
Wolfgang Walther
2025-06-13 07:39:33 +00:00
committed by GitHub
15 changed files with 837 additions and 2033 deletions
+7 -21
View File
@@ -19,9 +19,6 @@ let
;
};
# Haskell packages that require ghc 8.10
hs810Pkgs = import ./packages/ghc8_10 { inherit pkgs lib; };
# Haskell packages that require ghc 9.4
hs94Pkgs = import ./packages/ghc9_4 { inherit pkgs lib; };
@@ -37,11 +34,7 @@ let
assembleScope =
self: basics:
(hs96Pkgs self).elmPkgs
// (hs94Pkgs self).elmPkgs
// (hs810Pkgs self).elmPkgs
// (patchedNodePkgs self)
// basics;
(hs96Pkgs self).elmPkgs // (hs94Pkgs self).elmPkgs // (patchedNodePkgs self) // basics;
in
lib.makeScope pkgs.newScope (
self:
@@ -53,21 +46,14 @@ lib.makeScope pkgs.newScope (
/*
Node/NPM based dependencies can be upgraded using script `packages/generate-node-packages.sh`.
* Packages which rely on `bin-wrap` will fail by default
and can be patched using `patchBinwrap` function defined in `packages/lib.nix`.
* Packages which depend on npm installation of elm can be patched using
`patchNpmElm` function also defined in `packages/lib.nix`.
`patchNpmElm` function defined in `packages/lib.nix`.
*/
elmLib =
let
hsElmPkgs = (hs810Pkgs self) // (hs96Pkgs self);
in
import ./lib {
inherit lib;
inherit (pkgs) writeScriptBin stdenv;
inherit (self) elm;
};
elmLib = import ./lib {
inherit lib;
inherit (pkgs) writeScriptBin stdenv;
inherit (self) elm;
};
elm-json = callPackage ./packages/elm-json { };
+1 -39
View File
@@ -5,44 +5,6 @@
elm,
}:
let
patchBinwrap =
let
# Patching binwrap by NoOp script
binwrap = writeScriptBin "binwrap" ''
#! ${stdenv.shell}
echo "binwrap called: Returning 0"
return 0
'';
binwrap-install = writeScriptBin "binwrap-install" ''
#! ${stdenv.shell}
echo "binwrap-install called: Doing nothing"
'';
in
targets: pkg:
pkg.override (old: {
nativeBuildInputs = (old.nativeBuildInputs or [ ]) ++ [
binwrap
binwrap-install
];
# Manually install targets
# by symlinking binaries into `node_modules`
postInstall =
let
binFile = module: lib.strings.removeSuffix ("-" + module.version) module.name;
in
(old.postInstall or "")
+ ''
${lib.concatStrings (
map (module: ''
echo "linking ${binFile module}"
ln -sf ${module}/bin/${binFile module} \
node_modules/${binFile module}/bin/${binFile module}
'') targets
)}
'';
});
patchNpmElm =
pkg:
pkg.override (old: {
@@ -60,5 +22,5 @@ let
});
in
{
inherit patchBinwrap patchNpmElm;
inherit patchNpmElm;
}
@@ -12,14 +12,3 @@ is part of its repository.
Node dependencies are defined in [node-packages.json](node/node-packages.json).
[Node2nix](https://github.com/svanderburg/node2nix) is used for generating nix expression
from this file. Use [generate-node-packages.sh](node/generate-node-packages.sh) for updates of nix expressions.
## Binwrap Patch
Some node packages might use [binwrap](https://github.com/avh4/binwrap) typically for installing
[elmi-to-json](https://github.com/stoeffel/elmi-to-json). Binwrap is not compatible with nix.
To overcome issues with those packages apply [patch-binwrap.nix](../lib/default.nix) which essentially does 2 things.
1. It replaces binwrap scripts with noop shell scripts
2. It uses nix for installing the binaries to expected location in `node_modules`
Example usage be found in `elm/default.nix`.
@@ -1,41 +0,0 @@
{ pkgs, lib }:
self:
pkgs.haskell.packages.ghc810.override {
overrides =
self: super:
let
inherit (pkgs.haskell.lib.compose) justStaticExecutables overrideCabal doJailbreak;
elmPkgs = {
elmi-to-json = justStaticExecutables (
overrideCabal (drv: {
version = "unstable-2021-07-19";
src = pkgs.fetchgit {
url = "https://github.com/stoeffel/elmi-to-json";
sha256 = "0vy678k15rzpsn0aly90fb01pxsbqkgf86pa86w0gd94lka8acwl";
rev = "6a42376ef4b6877e130971faf964578cc096e29b";
fetchSubmodules = true;
};
prePatch = ''
substituteInPlace package.yaml --replace "- -Werror" ""
hpack
'';
jailbreak = true;
description = "Tool that reads .elmi files (Elm interface file) generated by the elm compiler";
homepage = "https://github.com/stoeffel/elmi-to-json";
license = lib.licenses.bsd3;
maintainers = [ lib.maintainers.turbomack ];
}) (self.callPackage ./elmi-to-json { })
);
};
in
elmPkgs
// {
inherit elmPkgs;
# aeson 2.0.3.0 does not build with attoparsec_0_13_2_5
aeson = doJailbreak self.aeson_1_5_6_0;
};
}
@@ -1,51 +0,0 @@
{
mkDerivation,
aeson,
base,
binary,
bytestring,
containers,
directory,
fetchgit,
filepath,
ghc-prim,
hpack,
lib,
optparse-applicative,
text,
unliftio,
unordered-containers,
}:
mkDerivation {
pname = "elmi-to-json";
version = "1.3.0";
src = fetchgit {
url = "https://github.com/stoeffel/elmi-to-json";
sha256 = "0vy678k15rzpsn0aly90fb01pxsbqkgf86pa86w0gd94lka8acwl";
rev = "6a42376ef4b6877e130971faf964578cc096e29b";
fetchSubmodules = true;
};
isLibrary = true;
isExecutable = true;
libraryHaskellDepends = [
aeson
base
binary
bytestring
containers
directory
filepath
ghc-prim
optparse-applicative
text
unliftio
unordered-containers
];
libraryToolDepends = [ hpack ];
executableHaskellDepends = [ base ];
testHaskellDepends = [ base ];
prePatch = "hpack";
homepage = "https://github.com/stoeffel/elmi-to-json#readme";
license = lib.licenses.bsd3;
mainProgram = "elmi-to-json";
}
@@ -33,46 +33,6 @@ 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 (_: {
@@ -89,8 +49,5 @@ 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 { };
};
}
@@ -1,92 +0,0 @@
{
mkDerivation,
ansi-terminal,
ansi-wl-pprint,
base,
binary,
bytestring,
Cabal,
cmark,
containers,
directory,
elm-format,
fetchgit,
filepath,
free,
HUnit,
indents,
json,
lib,
mtl,
optparse-applicative,
parsec,
process,
QuickCheck,
quickcheck-io,
split,
tasty,
tasty-golden,
tasty-hunit,
tasty-quickcheck,
text,
}:
mkDerivation {
pname = "elm-instrument";
version = "0.0.7";
src = fetchgit {
url = "https://github.com/zwilias/elm-instrument";
sha256 = "14yfzwsyvgc6rzn19sdmwk2mc1vma9hcljnmjnmlig8mp0271v56";
rev = "31b527e405a6afdb25bb87ad7bd14f979e65cff7";
fetchSubmodules = true;
};
isLibrary = true;
isExecutable = true;
setupHaskellDepends = [
base
Cabal
directory
filepath
process
];
libraryHaskellDepends = [
ansi-terminal
ansi-wl-pprint
base
binary
bytestring
containers
directory
filepath
free
indents
json
mtl
optparse-applicative
parsec
process
split
text
];
executableHaskellDepends = [ base ];
testHaskellDepends = [
base
cmark
containers
elm-format
HUnit
mtl
parsec
QuickCheck
quickcheck-io
split
tasty
tasty-golden
tasty-hunit
tasty-quickcheck
text
];
homepage = "http://elm-lang.org";
description = "Instrumentation library for Elm";
license = lib.licenses.bsd3;
mainProgram = "elm-instrument";
}
@@ -1,23 +0,0 @@
{
mkDerivation,
base,
concatenative,
lib,
mtl,
parsec,
}:
mkDerivation {
pname = "indents";
version = "0.3.3";
sha256 = "b61f51ac894609cb5571cc3ded12db5de97185a8de236c69ec24c87457109f9a";
libraryHaskellDepends = [
base
concatenative
mtl
parsec
];
doCheck = false;
homepage = "http://patch-tag.com/r/salazar/indents";
description = "indentation sensitive parser-combinators for parsec";
license = lib.licenses.bsd3;
}
@@ -12,25 +12,6 @@ let
inherit pkgs nodejs;
inherit (pkgs.stdenv.hostPlatform) system;
};
ESBUILD_BINARY_PATH = lib.getExe (
pkgs.esbuild.override {
buildGoModule =
args:
pkgs.buildGoModule (
args
// rec {
version = "0.20.2";
src = pkgs.fetchFromGitHub {
owner = "evanw";
repo = "esbuild";
rev = "v${version}";
hash = "sha256-h/Vqwax4B4nehRP9TaYbdixAZdb1hx373dNxNHvDrtY=";
};
vendorHash = "sha256-+BfxCyg0KkDQpHt/wycy/8CTG6YBA/VJvJFhhzUnSiQ=";
}
);
}
);
in
with self;
with elmLib;
@@ -43,65 +24,17 @@ with elmLib;
elm-git-install
;
elm-verify-examples =
let
patched = patchBinwrap [ elmi-to-json ] nodePkgs.elm-verify-examples // {
meta =
with lib;
nodePkgs.elm-verify-examples.meta
// {
description = "Verify examples in your docs";
homepage = "https://github.com/stoeffel/elm-verify-examples";
license = licenses.bsd3;
maintainers = [ maintainers.turbomack ];
};
elm-verify-examples = nodePkgs.elm-verify-examples // {
meta =
with lib;
nodePkgs.elm-verify-examples.meta
// {
description = "Verify examples in your docs";
homepage = "https://github.com/stoeffel/elm-verify-examples";
license = licenses.bsd3;
maintainers = [ maintainers.turbomack ];
};
in
patched.override (old: {
inherit ESBUILD_BINARY_PATH;
preRebuild =
(old.preRebuild or "")
+ ''
# This should not be needed (thanks to binwrap* being nooped) but for some reason it still needs to be done
# in case of just this package
# TODO: investigate, same as for elm-coverage below
sed 's/\"install\".*/\"install\":\"echo no-op\",/g' --in-place node_modules/elmi-to-json/package.json
'';
});
elm-coverage =
let
patched = patchNpmElm (patchBinwrap [ elmi-to-json ] nodePkgs.elm-coverage);
in
patched.override (old: {
# Symlink Elm instrument binary
preRebuild =
(old.preRebuild or "")
+ ''
# Noop custom installation script
sed 's/\"install\".*/\"install\":\"echo no-op\"/g' --in-place package.json
# This should not be needed (thanks to binwrap* being nooped) but for some reason it still needs to be done
# in case of just this package
# TODO: investigate
sed 's/\"install\".*/\"install\":\"echo no-op\",/g' --in-place node_modules/elmi-to-json/package.json
'';
postInstall =
(old.postInstall or "")
+ ''
mkdir -p unpacked_bin
ln -sf ${elm-instrument}/bin/elm-instrument unpacked_bin/elm-instrument
'';
meta =
with lib;
nodePkgs.elm-coverage.meta
// {
description = "Work in progress - Code coverage tooling for Elm";
homepage = "https://github.com/zwilias/elm-coverage";
license = licenses.bsd3;
maintainers = [ maintainers.turbomack ];
};
});
};
create-elm-app = patchNpmElm nodePkgs.create-elm-app // {
meta =
@@ -13,12 +13,12 @@ let
pkgs.buildGoModule (
args
// rec {
version = "0.21.5";
version = "0.25.5";
src = pkgs.fetchFromGitHub {
owner = "evanw";
repo = "esbuild";
rev = "v${version}";
hash = "sha256-FpvXWIlt67G8w3pBKZo/mcp57LunxDmRUaCU/Ne89B8=";
hash = "sha256-jemGZkWmN1x2+ZzJ5cLp3MoXO0oDKjtZTmZS9Be/TDw=";
};
vendorHash = "sha256-+BfxCyg0KkDQpHt/wycy/8CTG6YBA/VJvJFhhzUnSiQ=";
}
@@ -33,10 +33,6 @@ nodePkgs."elm-pages".overrideAttrs (old: {
old.nodejs.pkgs.node-gyp-build
];
preRebuild = ''
sed -i 's/"esbuild": "0\.19\.12"/"esbuild": "0.21.5"/' package.json
'';
# can't use `patches = [ <patch_file> ]` with a nodePkgs derivation;
# need to patch in one of the build phases instead.
# see upstream issue https://github.com/dillonkearns/elm-pages/issues/305 for dealing with the read-only problem
@@ -10,5 +10,3 @@ $(nix-build $ROOT -A nodePackages.node2nix --no-out-link)/bin/node2nix \
-o node-packages.nix \
-c node-composition.nix \
--no-copy-node-env -e ../../../../node-packages/node-env.nix
# well, elm-pages requires two different version of esbuild so we twist it's wrist to only use one
sed -i 's/sources."esbuild-0.19.12"/sources."esbuild-0.21.5"/' node-packages.nix
@@ -1,6 +1,5 @@
[
"elm-analyse",
"elm-coverage",
"elm-doc-preview",
"@elm-tooling/elm-language-server",
"elm-live",
File diff suppressed because it is too large Load Diff
-2
View File
@@ -2,13 +2,11 @@
#!nix-shell -p cabal2nix elm2nix -i bash ../../..
# Update all cabal packages.
cabal2nix 'https://github.com/zwilias/elm-instrument' --revision '0.0.7' > packages/ghc8_10/elm-instrument/default.nix
for subpath in 'avh4-lib' 'elm-format-lib' 'elm-format-markdown' 'elm-format-test-lib'; do
cabal2nix 'https://github.com/avh4/elm-format' --revision '0.8.7' \
--subpath $subpath > packages/ghc9_2/elm-format/${subpath}.nix
done
cabal2nix 'https://github.com/avh4/elm-format' --revision '0.8.7' > packages/ghc9_2/elm-format/elm-format.nix
cabal2nix 'https://github.com/stoeffel/elmi-to-json' --revision '1.3.0' > packages/ghc8_10/elmi-to-json/default.nix
cabal2nix 'https://github.com/ekmett/ansi-wl-pprint' --revision 'v0.6.8.1' > packages/ghc9_6/ansi-wl-pprint/default.nix
# We're building binaries from commit that npm installer is using since
-2
View File
@@ -393,8 +393,6 @@ let
inherit (pkgsPlatforms.elmPackages)
elm
elm-format
elm-instrument
elmi-to-json
;
};