Skip to content

Commit ac08760

Browse files
committed
tools: extract Nix dependency lists to separate files
This should improve the readability, as well as the UX of cherry-picking what dependency the user wants in their env. PR-URL: #60495 Reviewed-By: Jacob Smith <jacob@frende.me>
1 parent 26a5305 commit ac08760

File tree

5 files changed

+73
-60
lines changed

5 files changed

+73
-60
lines changed

BUILDING.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -299,7 +299,7 @@ that flag to use all the shared dependencies, or specify only some dependencies:
299299
```bash
300300
cat -> .envrc <<'EOF'
301301
use nix --arg sharedLibDeps '{
302-
inherit (import <nixpkgs> {})
302+
inherit (import ./tools/nix/sharedLibDeps.nix {})
303303
openssl
304304
zlib
305305
;

shell.nix

Lines changed: 4 additions & 59 deletions
Original file line numberDiff line numberDiff line change
@@ -1,68 +1,13 @@
11
{
2-
pkgs ? import "${./tools/nix/pkgs.nix}" { },
2+
pkgs ? import ./tools/nix/pkgs.nix { },
33
loadJSBuiltinsDynamically ? true, # Load `lib/**.js` from disk instead of embedding
44
ncu-path ? null, # Provide this if you want to use a local version of NCU
55
icu ? pkgs.icu,
6-
sharedLibDeps ? {
7-
inherit (pkgs)
8-
ada
9-
brotli
10-
c-ares
11-
libuv
12-
nghttp2
13-
nghttp3
14-
ngtcp2
15-
simdjson
16-
simdutf
17-
sqlite
18-
uvwasi
19-
zlib
20-
zstd
21-
;
22-
http-parser = pkgs.llhttp;
23-
openssl = pkgs.openssl.overrideAttrs (old: {
24-
version = "3.5.4";
25-
src = pkgs.fetchurl {
26-
url = builtins.replaceStrings [ old.version ] [ "3.5.4" ] old.src.url;
27-
hash = "sha256-lnMR+ElVMWlpvbHY1LmDcY70IzhjnGIexMNP3e81Xpk=";
28-
};
29-
doCheck = false;
30-
configureFlags = (old.configureFlags or [ ]) ++ [
31-
"no-docs"
32-
"no-tests"
33-
];
34-
outputs = [
35-
"bin"
36-
"out"
37-
"dev"
38-
];
39-
});
40-
},
6+
sharedLibDeps ? import ./tools/nix/sharedLibDeps.nix { inherit pkgs; },
417
ccache ? pkgs.ccache,
428
ninja ? pkgs.ninja,
43-
devTools ? [
44-
pkgs.curl
45-
pkgs.gh
46-
pkgs.git
47-
pkgs.jq
48-
pkgs.shellcheck
49-
]
50-
++ (
51-
if (ncu-path == null) then
52-
[ pkgs.node-core-utils ]
53-
else
54-
[
55-
(pkgs.writeShellScriptBin "git-node" "exec \"${ncu-path}/bin/git-node.js\" \"$@\"")
56-
(pkgs.writeShellScriptBin "ncu-ci" "exec \"${ncu-path}/bin/ncu-ci.js\" \"$@\"")
57-
(pkgs.writeShellScriptBin "ncu-config" "exec \"${ncu-path}/bin/ncu-config.js\" \"$@\"")
58-
]
59-
),
60-
benchmarkTools ? [
61-
pkgs.R
62-
pkgs.rPackages.ggplot2
63-
pkgs.rPackages.plyr
64-
pkgs.wrk
65-
],
9+
devTools ? import ./tools/nix/devTools.nix { inherit pkgs ncu-path; },
10+
benchmarkTools ? import ./tools/nix/benchmarkTools.nix { inherit pkgs; },
6611
extraConfigFlags ? [
6712
"--without-npm"
6813
"--debug-node"

tools/nix/benchmarkTools.nix

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
{
2+
pkgs ? import ./pkgs.nix { },
3+
}:
4+
[
5+
pkgs.R
6+
pkgs.rPackages.ggplot2
7+
pkgs.rPackages.plyr
8+
pkgs.wrk
9+
]

tools/nix/devTools.nix

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
{
2+
pkgs ? import ./pkgs.nix { },
3+
ncu-path ? null, # Provide this if you want to use a local version of NCU
4+
}:
5+
[
6+
pkgs.curl
7+
pkgs.gh
8+
pkgs.git
9+
pkgs.jq
10+
pkgs.shellcheck
11+
]
12+
++ (
13+
if (ncu-path == null) then
14+
[ pkgs.node-core-utils ]
15+
else
16+
[
17+
(pkgs.writeShellScriptBin "git-node" "exec \"${ncu-path}/bin/git-node.js\" \"$@\"")
18+
(pkgs.writeShellScriptBin "ncu-ci" "exec \"${ncu-path}/bin/ncu-ci.js\" \"$@\"")
19+
(pkgs.writeShellScriptBin "ncu-config" "exec \"${ncu-path}/bin/ncu-config.js\" \"$@\"")
20+
]
21+
)

tools/nix/sharedLibDeps.nix

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
{
2+
pkgs ? import ./pkgs.nix { },
3+
}:
4+
{
5+
inherit (pkgs)
6+
ada
7+
brotli
8+
c-ares
9+
libuv
10+
nghttp2
11+
nghttp3
12+
ngtcp2
13+
simdjson
14+
simdutf
15+
sqlite
16+
uvwasi
17+
zlib
18+
zstd
19+
;
20+
http-parser = pkgs.llhttp;
21+
openssl = pkgs.openssl.overrideAttrs (old: {
22+
version = "3.5.4";
23+
src = pkgs.fetchurl {
24+
url = builtins.replaceStrings [ old.version ] [ "3.5.4" ] old.src.url;
25+
hash = "sha256-lnMR+ElVMWlpvbHY1LmDcY70IzhjnGIexMNP3e81Xpk=";
26+
};
27+
doCheck = false;
28+
configureFlags = (old.configureFlags or [ ]) ++ [
29+
"no-docs"
30+
"no-tests"
31+
];
32+
outputs = [
33+
"bin"
34+
"out"
35+
"dev"
36+
];
37+
});
38+
}

0 commit comments

Comments
 (0)