-
-
Notifications
You must be signed in to change notification settings - Fork 14.5k
/
overrides.nix
372 lines (337 loc) · 12.2 KB
/
overrides.nix
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
# Do not use overrides in this file to add `meta.mainProgram` to packages. Use `./main-programs.nix`
# instead.
{ pkgs, nodejs }:
let
inherit (pkgs)
stdenv
lib
callPackage
fetchFromGitHub
fetchurl
fetchpatch
nixosTests;
since = version: lib.versionAtLeast nodejs.version version;
before = version: lib.versionOlder nodejs.version version;
in
final: prev: {
inherit nodejs;
"@angular/cli" = prev."@angular/cli".override {
prePatch = ''
export NG_CLI_ANALYTICS=false
'';
nativeBuildInputs = [ pkgs.installShellFiles ];
postInstall = lib.optionalString (stdenv.buildPlatform.canExecute stdenv.hostPlatform) ''
for shell in bash zsh; do
installShellCompletion --cmd ng \
--$shell <($out/bin/ng completion script)
done
'';
};
"@electron-forge/cli" = prev."@electron-forge/cli".override {
buildInputs = [ final.node-gyp-build ];
};
fast-cli = prev.fast-cli.override {
nativeBuildInputs = [ pkgs.buildPackages.makeWrapper ];
prePatch = ''
export PUPPETEER_SKIP_DOWNLOAD=1
'';
postInstall = ''
wrapProgram $out/bin/fast \
--set PUPPETEER_EXECUTABLE_PATH ${pkgs.chromium.outPath}/bin/chromium
'';
};
fauna-shell = prev.fauna-shell.override {
# printReleaseNotes just pulls them from GitHub which is not allowed in sandbox
preRebuild = ''
sed -i 's|"node ./tools/printReleaseNotes"|"true"|' node_modules/faunadb/package.json
'';
};
graphql-language-service-cli = prev.graphql-language-service-cli.override {
nativeBuildInputs = [ pkgs.buildPackages.makeWrapper ];
postInstall = ''
wrapProgram "$out/bin/graphql-lsp" \
--prefix NODE_PATH : ${final.graphql}/lib/node_modules
'';
};
ijavascript = prev.ijavascript.override (oldAttrs: {
preRebuild = ''
export npm_config_zmq_external=true
'';
buildInputs = oldAttrs.buildInputs ++ [ final.node-gyp-build pkgs.zeromq ];
});
joplin = prev.joplin.override (oldAttrs:{
nativeBuildInputs = [
pkgs.pkg-config
(pkgs.python3.withPackages (ps: [ ps.setuptools ]))
] ++ lib.optionals stdenv.hostPlatform.isDarwin [
pkgs.xcbuild
];
buildInputs = with pkgs; [
# required by sharp
# https://sharp.pixelplumbing.com/install
vips
libsecret
final.node-gyp-build
node-pre-gyp
pixman
cairo
pango
] ++ lib.optionals stdenv.hostPlatform.isDarwin [
darwin.apple_sdk.frameworks.AppKit
darwin.apple_sdk.frameworks.Security
];
# add newer node-addon-api to build sharp
# https://github.com/lovell/sharp/issues/3920
dependencies = [
{
name = "node-addon-api";
packageName = "node-addon-api";
version = "7.1.0";
src = fetchurl {
url = "https://registry.npmjs.org/node-addon-api/-/node-addon-api-7.1.0.tgz";
sha512 = "mNcltoe1R8o7STTegSOHdnJNN7s5EUvhoS7ShnTHDyOSd+8H+UdWODq6qSv67PjC8Zc5JRT8+oLAMCr0SIXw7g==";
};
}
] ++ oldAttrs.dependencies;
meta = oldAttrs.meta // {
# ModuleNotFoundError: No module named 'distutils'
broken = stdenv.hostPlatform.isDarwin; # still broken on darwin
};
});
jsonplaceholder = prev.jsonplaceholder.override {
buildInputs = [ nodejs ];
postInstall = ''
exe=$out/bin/jsonplaceholder
mkdir -p $out/bin
cat >$exe <<EOF
#!${pkgs.runtimeShell}
exec -a jsonplaceholder ${nodejs}/bin/node $out/lib/node_modules/jsonplaceholder/index.js
EOF
chmod a+x $exe
'';
};
keyoxide = prev.keyoxide.override {
nativeBuildInputs = [ pkgs.pkg-config ];
buildInputs = with pkgs; [
pixman
cairo
pango
] ++ lib.optionals stdenv.hostPlatform.isDarwin [
darwin.apple_sdk.frameworks.CoreText
];
};
makam = prev.makam.override {
nativeBuildInputs = [ pkgs.buildPackages.makeWrapper ];
postFixup = ''
wrapProgram "$out/bin/makam" --prefix PATH : ${lib.makeBinPath [ nodejs ]}
${lib.optionalString stdenv.hostPlatform.isLinux "patchelf --set-interpreter ${stdenv.cc.libc}/lib/ld-linux-x86-64.so.2 \"$out/lib/node_modules/makam/makam-bin-linux64\""}
'';
};
node2nix = prev.node2nix.override {
# Get latest commit for misc fixes
src = fetchFromGitHub {
owner = "svanderburg";
repo = "node2nix";
rev = "315e1b85a6761152f57a41ccea5e2570981ec670";
sha256 = "sha256-8OxTOkwBPcnjyhXhxQEDd8tiaQoHt91zUJX5Ka+IXco=";
};
nativeBuildInputs = [ pkgs.buildPackages.makeWrapper ];
postInstall = let
patches = [
# Needed to fix packages with DOS line-endings after above patch - PR svanderburg/node2nix#314
(fetchpatch {
name = "convert-crlf-for-script-bin-files.patch";
url = "https://github.com/svanderburg/node2nix/commit/91aa511fe7107938b0409a02ab8c457a6de2d8ca.patch";
hash = "sha256-ISiKYkur/o8enKDzJ8mQndkkSC4yrTNlheqyH+LiXlU=";
})
# fix nodejs attr names
(fetchpatch {
url = "https://github.com/svanderburg/node2nix/commit/3b63e735458947ef39aca247923f8775633363e5.patch";
hash = "sha256-pe8Xm4mjPh9oKXugoMY6pRl8YYgtdw0sRXN+TienalU=";
})
# Use top-level cctools in generated files - PR svanderburg/node2nix#334
(fetchpatch {
url = "https://github.com/svanderburg/node2nix/commit/31c308bba5f39ea0105f66b9f40dbe57fed7a292.patch";
hash = "sha256-DdNRteonMvyffPh0uo0lUbsohKYnyqv0QcD9vjN6aXE=";
})
];
in ''
${lib.concatStringsSep "\n" (map (patch: "patch -d $out/lib/node_modules/node2nix -p1 < ${patch}") patches)}
wrapProgram "$out/bin/node2nix" --prefix PATH : ${lib.makeBinPath [ pkgs.nix ]}
'';
};
postcss-cli = prev.postcss-cli.override (oldAttrs: let
esbuild-version = (lib.findFirst (dep: dep.name == "esbuild") null oldAttrs.dependencies).version;
esbuild-linux-x64 = {
name = "_at_esbuild_slash_esbuild-linux-x64";
packageName = "@esbuild/linux-x64";
version = esbuild-version;
src = fetchurl {
url = "https://registry.npmjs.org/@esbuild/linux-x64/-/linux-x64-${esbuild-version}.tgz";
sha512 = "sha512-EV6+ovTsEXCPAp58g2dD68LxoP/wK5pRvgy0J/HxPGB009omFPv3Yet0HiaqvrIrgPTBuC6wCH1LTOY91EO5hQ==";
};
};
esbuild-linux-arm64 = {
name = "_at_esbuild_slash_esbuild-linux-arm64";
packageName = "@esbuild/linux-arm64";
version = esbuild-version;
src = fetchurl {
url = "https://registry.npmjs.org/@esbuild/linux-arm64/-/linux-arm64-${esbuild-version}.tgz";
sha512 = "sha512-/93bf2yxencYDnItMYV/v116zff6UyTjo4EtEQjUBeGiVpMmffDNUyD9UN2zV+V3LRV3/on4xdZ26NKzn6754g==";
};
};
esbuild-darwin-x64 = {
name = "_at_esbuild_slash_esbuild-darwin-x64";
packageName = "@esbuild/darwin-x64";
version = esbuild-version;
src = fetchurl {
url = "https://registry.npmjs.org/@esbuild/darwin-x64/-/darwin-x64-${esbuild-version}.tgz";
sha512 = "sha512-aClqdgTDVPSEGgoCS8QDG37Gu8yc9lTHNAQlsztQ6ENetKEO//b8y31MMu2ZaPbn4kVsIABzVLXYLhCGekGDqw==";
};
};
esbuild-darwin-arm64 = {
name = "_at_esbuild_slash_esbuild-darwin-arm64";
packageName = "@esbuild/darwin-arm64";
version = esbuild-version;
src = fetchurl {
url = "https://registry.npmjs.org/@esbuild/darwin-arm64/-/darwin-arm64-${esbuild-version}.tgz";
sha512 = "sha512-YsS2e3Wtgnw7Wq53XXBLcV6JhRsEq8hkfg91ESVadIrzr9wO6jJDMZnCQbHm1Guc5t/CdDiFSSfWP58FNuvT3Q==";
};
};
in{
nativeBuildInputs = [ pkgs.buildPackages.makeWrapper ];
dependencies = oldAttrs.dependencies
++ lib.optional (stdenv.hostPlatform.isLinux && stdenv.hostPlatform.isx86_64) esbuild-linux-x64
++ lib.optional (stdenv.hostPlatform.isLinux && stdenv.hostPlatform.isAarch64) esbuild-linux-arm64
++ lib.optional (stdenv.hostPlatform.isDarwin && stdenv.hostPlatform.isx86_64) esbuild-darwin-x64
++ lib.optional (stdenv.hostPlatform.isDarwin && stdenv.hostPlatform.isAarch64) esbuild-darwin-arm64;
postInstall = ''
wrapProgram "$out/bin/postcss" \
--prefix NODE_PATH : ${final.postcss}/lib/node_modules \
--prefix NODE_PATH : ${pkgs.autoprefixer}/node_modules
ln -s '${final.postcss}/lib/node_modules/postcss' "$out/lib/node_modules/postcss"
'';
passthru.tests = {
simple-execution = callPackage ./package-tests/postcss-cli.nix {
inherit (final) postcss-cli;
};
};
meta = oldAttrs.meta // {
maintainers = with lib.maintainers; [ Luflosi ];
license = lib.licenses.mit;
};
});
pulp = prev.pulp.override {
# tries to install purescript
npmFlags = builtins.toString [ "--ignore-scripts" ];
nativeBuildInputs = [ pkgs.buildPackages.makeWrapper ];
postInstall = ''
wrapProgram "$out/bin/pulp" --suffix PATH : ${lib.makeBinPath [
pkgs.purescript
]}
'';
};
rush = prev."@microsoft/rush".override {
name = "rush";
};
tailwindcss = prev.tailwindcss.override {
plugins = [ ];
nativeBuildInputs = [ pkgs.buildPackages.makeWrapper ];
postInstall = ''
nodePath=""
for p in "$out" "${final.postcss}" $plugins; do
nodePath="$nodePath''${nodePath:+:}$p/lib/node_modules"
done
wrapProgram "$out/bin/tailwind" \
--prefix NODE_PATH : "$nodePath"
wrapProgram "$out/bin/tailwindcss" \
--prefix NODE_PATH : "$nodePath"
unset nodePath
'';
passthru.tests = {
simple-execution = callPackage ./package-tests/tailwindcss.nix {
inherit (final) tailwindcss;
};
};
};
thelounge-plugin-closepms = prev.thelounge-plugin-closepms.override {
nativeBuildInputs = [ pkgs.node-pre-gyp ];
};
thelounge-plugin-giphy = prev.thelounge-plugin-giphy.override {
nativeBuildInputs = [ pkgs.node-pre-gyp ];
};
thelounge-theme-flat-blue = prev.thelounge-theme-flat-blue.override {
nativeBuildInputs = [ pkgs.node-pre-gyp ];
# TODO: needed until upstream pins thelounge version 4.3.1+ (which fixes dependency on old sqlite3 and transitively very old node-gyp 3.x)
preRebuild = ''
rm -r node_modules/node-gyp
'';
};
thelounge-theme-flat-dark = prev.thelounge-theme-flat-dark.override {
nativeBuildInputs = [ pkgs.node-pre-gyp ];
# TODO: needed until upstream pins thelounge version 4.3.1+ (which fixes dependency on old sqlite3 and transitively very old node-gyp 3.x)
preRebuild = ''
rm -r node_modules/node-gyp
'';
};
ts-node = prev.ts-node.override {
nativeBuildInputs = [ pkgs.buildPackages.makeWrapper ];
postInstall = ''
wrapProgram "$out/bin/ts-node" \
--prefix NODE_PATH : ${pkgs.typescript}/lib/node_modules
'';
};
tsun = prev.tsun.override {
nativeBuildInputs = [ pkgs.buildPackages.makeWrapper ];
postInstall = ''
wrapProgram "$out/bin/tsun" \
--prefix NODE_PATH : ${pkgs.typescript}/lib/node_modules
'';
};
uppy-companion = prev."@uppy/companion".override {
name = "uppy-companion";
};
vega-cli = prev.vega-cli.override {
nativeBuildInputs = [ pkgs.pkg-config ];
buildInputs = with pkgs; [
node-pre-gyp
pixman
cairo
pango
libjpeg
] ++ lib.optionals stdenv.hostPlatform.isDarwin [
darwin.apple_sdk.frameworks.CoreText
];
};
vega-lite = prev.vega-lite.override {
postInstall = ''
cd node_modules
for dep in ${final.vega-cli}/lib/node_modules/vega-cli/node_modules/*; do
if [[ ! -d ''${dep##*/} ]]; then
ln -s "${final.vega-cli}/lib/node_modules/vega-cli/node_modules/''${dep##*/}"
fi
done
'';
passthru.tests = {
simple-execution = callPackage ./package-tests/vega-lite.nix {
inherit (final) vega-lite;
};
};
};
wavedrom-cli = prev.wavedrom-cli.override {
nativeBuildInputs = [ pkgs.pkg-config pkgs.node-pre-gyp ];
# These dependencies are required by
# https://github.com/Automattic/node-canvas.
buildInputs = with pkgs; [
giflib
pixman
cairo
pango
] ++ lib.optionals stdenv.hostPlatform.isDarwin [
darwin.apple_sdk.frameworks.CoreText
];
};
webtorrent-cli = prev.webtorrent-cli.override {
buildInputs = [ final.node-gyp-build ];
};
}