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: https://github.com/nodejs/node/pull/60495
Reviewed-By: Jacob Smith <jacob@frende.me>
This commit is contained in:
Antoine du Hamel 2025-11-08 13:53:47 +01:00 committed by GitHub
parent 8e5c80d108
commit c94047dfda
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
5 changed files with 73 additions and 60 deletions

View File

@ -299,7 +299,7 @@ that flag to use all the shared dependencies, or specify only some dependencies:
```bash
cat -> .envrc <<'EOF'
use nix --arg sharedLibDeps '{
inherit (import <nixpkgs> {})
inherit (import ./tools/nix/sharedLibDeps.nix {})
openssl
zlib
;

View File

@ -1,68 +1,13 @@
{
pkgs ? import "${./tools/nix/pkgs.nix}" { },
pkgs ? import ./tools/nix/pkgs.nix { },
loadJSBuiltinsDynamically ? true, # Load `lib/**.js` from disk instead of embedding
ncu-path ? null, # Provide this if you want to use a local version of NCU
icu ? pkgs.icu,
sharedLibDeps ? {
inherit (pkgs)
ada
brotli
c-ares
libuv
nghttp2
nghttp3
ngtcp2
simdjson
simdutf
sqlite
uvwasi
zlib
zstd
;
http-parser = pkgs.llhttp;
openssl = pkgs.openssl.overrideAttrs (old: {
version = "3.5.4";
src = pkgs.fetchurl {
url = builtins.replaceStrings [ old.version ] [ "3.5.4" ] old.src.url;
hash = "sha256-lnMR+ElVMWlpvbHY1LmDcY70IzhjnGIexMNP3e81Xpk=";
};
doCheck = false;
configureFlags = (old.configureFlags or [ ]) ++ [
"no-docs"
"no-tests"
];
outputs = [
"bin"
"out"
"dev"
];
});
},
sharedLibDeps ? import ./tools/nix/sharedLibDeps.nix { inherit pkgs; },
ccache ? pkgs.ccache,
ninja ? pkgs.ninja,
devTools ? [
pkgs.curl
pkgs.gh
pkgs.git
pkgs.jq
pkgs.shellcheck
]
++ (
if (ncu-path == null) then
[ pkgs.node-core-utils ]
else
[
(pkgs.writeShellScriptBin "git-node" "exec \"${ncu-path}/bin/git-node.js\" \"$@\"")
(pkgs.writeShellScriptBin "ncu-ci" "exec \"${ncu-path}/bin/ncu-ci.js\" \"$@\"")
(pkgs.writeShellScriptBin "ncu-config" "exec \"${ncu-path}/bin/ncu-config.js\" \"$@\"")
]
),
benchmarkTools ? [
pkgs.R
pkgs.rPackages.ggplot2
pkgs.rPackages.plyr
pkgs.wrk
],
devTools ? import ./tools/nix/devTools.nix { inherit pkgs ncu-path; },
benchmarkTools ? import ./tools/nix/benchmarkTools.nix { inherit pkgs; },
extraConfigFlags ? [
"--without-npm"
"--debug-node"

View File

@ -0,0 +1,9 @@
{
pkgs ? import ./pkgs.nix { },
}:
[
pkgs.R
pkgs.rPackages.ggplot2
pkgs.rPackages.plyr
pkgs.wrk
]

21
tools/nix/devTools.nix Normal file
View File

@ -0,0 +1,21 @@
{
pkgs ? import ./pkgs.nix { },
ncu-path ? null, # Provide this if you want to use a local version of NCU
}:
[
pkgs.curl
pkgs.gh
pkgs.git
pkgs.jq
pkgs.shellcheck
]
++ (
if (ncu-path == null) then
[ pkgs.node-core-utils ]
else
[
(pkgs.writeShellScriptBin "git-node" "exec \"${ncu-path}/bin/git-node.js\" \"$@\"")
(pkgs.writeShellScriptBin "ncu-ci" "exec \"${ncu-path}/bin/ncu-ci.js\" \"$@\"")
(pkgs.writeShellScriptBin "ncu-config" "exec \"${ncu-path}/bin/ncu-config.js\" \"$@\"")
]
)

View File

@ -0,0 +1,38 @@
{
pkgs ? import ./pkgs.nix { },
}:
{
inherit (pkgs)
ada
brotli
c-ares
libuv
nghttp2
nghttp3
ngtcp2
simdjson
simdutf
sqlite
uvwasi
zlib
zstd
;
http-parser = pkgs.llhttp;
openssl = pkgs.openssl.overrideAttrs (old: {
version = "3.5.4";
src = pkgs.fetchurl {
url = builtins.replaceStrings [ old.version ] [ "3.5.4" ] old.src.url;
hash = "sha256-lnMR+ElVMWlpvbHY1LmDcY70IzhjnGIexMNP3e81Xpk=";
};
doCheck = false;
configureFlags = (old.configureFlags or [ ]) ++ [
"no-docs"
"no-tests"
];
outputs = [
"bin"
"out"
"dev"
];
});
}