1{
2 pkgs,
3 lib,
4 nodejs,
5 makeWrapper,
6}:
7self:
8
9let
10 # Untouched npm-downloaded packages
11 nodePkgs = pkgs.callPackage ./node-composition.nix {
12 inherit pkgs nodejs;
13 inherit (pkgs.stdenv.hostPlatform) system;
14 };
15 ESBUILD_BINARY_PATH = lib.getExe (
16 pkgs.esbuild.override {
17 buildGoModule =
18 args:
19 pkgs.buildGoModule (
20 args
21 // rec {
22 version = "0.20.2";
23 src = pkgs.fetchFromGitHub {
24 owner = "evanw";
25 repo = "esbuild";
26 rev = "v${version}";
27 hash = "sha256-h/Vqwax4B4nehRP9TaYbdixAZdb1hx373dNxNHvDrtY=";
28 };
29 vendorHash = "sha256-+BfxCyg0KkDQpHt/wycy/8CTG6YBA/VJvJFhhzUnSiQ=";
30 }
31 );
32 }
33 );
34in
35with self;
36with elmLib;
37{
38 inherit (nodePkgs)
39 elm-live
40 elm-upgrade
41 elm-xref
42 elm-analyse
43 elm-git-install
44 ;
45
46 elm-verify-examples =
47 let
48 patched = patchBinwrap [ elmi-to-json ] nodePkgs.elm-verify-examples // {
49 meta =
50 with lib;
51 nodePkgs.elm-verify-examples.meta
52 // {
53 description = "Verify examples in your docs";
54 homepage = "https://github.com/stoeffel/elm-verify-examples";
55 license = licenses.bsd3;
56 maintainers = [ maintainers.turbomack ];
57 };
58 };
59 in
60 patched.override (old: {
61 inherit ESBUILD_BINARY_PATH;
62 preRebuild =
63 (old.preRebuild or "")
64 + ''
65 # This should not be needed (thanks to binwrap* being nooped) but for some reason it still needs to be done
66 # in case of just this package
67 # TODO: investigate, same as for elm-coverage below
68 sed 's/\"install\".*/\"install\":\"echo no-op\",/g' --in-place node_modules/elmi-to-json/package.json
69 '';
70 });
71
72 elm-coverage =
73 let
74 patched = patchNpmElm (patchBinwrap [ elmi-to-json ] nodePkgs.elm-coverage);
75 in
76 patched.override (old: {
77 # Symlink Elm instrument binary
78 preRebuild =
79 (old.preRebuild or "")
80 + ''
81 # Noop custom installation script
82 sed 's/\"install\".*/\"install\":\"echo no-op\"/g' --in-place package.json
83
84 # This should not be needed (thanks to binwrap* being nooped) but for some reason it still needs to be done
85 # in case of just this package
86 # TODO: investigate
87 sed 's/\"install\".*/\"install\":\"echo no-op\",/g' --in-place node_modules/elmi-to-json/package.json
88 '';
89 postInstall =
90 (old.postInstall or "")
91 + ''
92 mkdir -p unpacked_bin
93 ln -sf ${elm-instrument}/bin/elm-instrument unpacked_bin/elm-instrument
94 '';
95 meta =
96 with lib;
97 nodePkgs.elm-coverage.meta
98 // {
99 description = "Work in progress - Code coverage tooling for Elm";
100 homepage = "https://github.com/zwilias/elm-coverage";
101 license = licenses.bsd3;
102 maintainers = [ maintainers.turbomack ];
103 };
104 });
105
106 create-elm-app = patchNpmElm nodePkgs.create-elm-app // {
107 meta =
108 with lib;
109 nodePkgs.create-elm-app.meta
110 // {
111 description = "Create Elm apps with no build configuration";
112 homepage = "https://github.com/halfzebra/create-elm-app";
113 license = licenses.mit;
114 maintainers = [ maintainers.turbomack ];
115 };
116 };
117
118 elm-graphql = nodePkgs."@dillonkearns/elm-graphql" // {
119 meta =
120 with lib;
121 nodePkgs."@dillonkearns/elm-graphql".meta
122 // {
123 description = " Autogenerate type-safe GraphQL queries in Elm";
124 license = licenses.bsd3;
125 maintainers = [ maintainers.pedrohlc ];
126 };
127 };
128
129 elm-language-server = nodePkgs."@elm-tooling/elm-language-server" // {
130 meta =
131 with lib;
132 nodePkgs."@elm-tooling/elm-language-server".meta
133 // {
134 description = "Language server implementation for Elm";
135 homepage = "https://github.com/elm-tooling/elm-language-server";
136 license = licenses.mit;
137 maintainers = [ maintainers.turbomack ];
138 };
139 };
140
141 elm-spa = nodePkgs."elm-spa".overrideAttrs (old: {
142 nativeBuildInputs = (old.nativeBuildInputs or [ ]) ++ [
143 makeWrapper
144 old.nodejs.pkgs.node-gyp-build
145 ];
146
147 meta =
148 with lib;
149 nodePkgs."elm-spa".meta
150 // {
151 description = "Tool for building single page apps in Elm";
152 homepage = "https://www.elm-spa.dev/";
153 license = licenses.bsd3;
154 maintainers = [ maintainers.ilyakooo0 ];
155 };
156 });
157
158 elm-optimize-level-2 = nodePkgs."elm-optimize-level-2" // {
159 meta =
160 with lib;
161 nodePkgs."elm-optimize-level-2".meta
162 // {
163 description = "Second level of optimization for the Javascript that the Elm Compiler produces";
164 homepage = "https://github.com/mdgriffith/elm-optimize-level-2";
165 license = licenses.bsd3;
166 maintainers = [ maintainers.turbomack ];
167 };
168 };
169
170 elm-pages = import ./elm-pages {
171 inherit
172 nodePkgs
173 pkgs
174 lib
175 makeWrapper
176 ;
177 };
178
179 elm-land = pkgs.elm-land; # Alias
180
181 elm-doc-preview = nodePkgs."elm-doc-preview".overrideAttrs (old: {
182 nativeBuildInputs = (old.nativeBuildInputs or [ ]) ++ [ old.nodejs.pkgs.node-gyp-build ];
183 });
184}