11{
22 pkgs ? import ./tools/nix/pkgs.nix { } ,
3- loadJSBuiltinsDynamically ? true , # Load `lib/**.js` from disk instead of embedding
4- withTemporal ? false ,
5- ncu-path ? null , # Provide this if you want to use a local version of NCU
6- icu ? pkgs . icu ,
7- sharedLibDeps ? import ./tools/nix/sharedLibDeps.nix { inherit pkgs withTemporal ; } ,
3+
4+ # Optional build tools / config
85 ccache ? pkgs . ccache ,
6+ loadJSBuiltinsDynamically ? true , # Load `lib/**.js` from disk instead of embedding
97 ninja ? pkgs . ninja ,
10- devTools ? import ./tools/nix/devTools.nix { inherit pkgs ncu-path ; } ,
11- benchmarkTools ? import ./tools/nix/benchmarkTools.nix { inherit pkgs ; } ,
128 extraConfigFlags ? [
139 "--without-npm"
1410 "--debug-node"
15- ]
16- ++ pkgs . lib . optionals withTemporal [
17- "--v8-enable-temporal-support"
1811 ] ,
12+
13+ # Build options
14+ icu ? pkgs . icu ,
15+ withAmaro ? true ,
16+ withSQLite ? true ,
17+ withSSL ? true ,
18+ withTemporal ? false ,
19+ sharedLibDeps ? import ./tools/nix/sharedLibDeps.nix {
20+ inherit
21+ pkgs
22+ withSQLite
23+ withSSL
24+ withTemporal
25+ ;
26+ } ,
27+
28+ # dev tools (not needed to build Node.js, useful to maintain it)
29+ ncu-path ? null , # Provide this if you want to use a local version of NCU
30+ devTools ? import ./tools/nix/devTools.nix { inherit pkgs ncu-path ; } ,
31+ benchmarkTools ? import ./tools/nix/benchmarkTools.nix { inherit pkgs ; } ,
1932} :
2033
2134let
2235 useSharedICU = if builtins . isString icu then icu == "system" else icu != null ;
2336 useSharedAda = builtins . hasAttr "ada" sharedLibDeps ;
2437 useSharedOpenSSL = builtins . hasAttr "openssl" sharedLibDeps ;
38+
39+ needsRustCompiler = withTemporal && ! builtins . hasAttr "temporal_capi" sharedLibDeps ;
2540in
2641pkgs . mkShell {
2742 inherit ( pkgs . nodejs_latest ) nativeBuildInputs ;
2843
2944 buildInputs = builtins . attrValues sharedLibDeps ++ pkgs . lib . optional useSharedICU icu ;
3045
31- packages = [
32- ccache
33- ]
34- ++ devTools
35- ++ benchmarkTools
36- ++ pkgs . lib . optionals ( withTemporal && ! builtins . hasAttr "temporal_capi" sharedLibDeps ) [
37- pkgs . cargo
38- pkgs . rustc
39- ] ;
46+ packages =
47+ pkgs . lib . optional ( ccache != null ) ccache
48+ ++ devTools
49+ ++ benchmarkTools
50+ ++ pkgs . lib . optionals needsRustCompiler [
51+ pkgs . cargo
52+ pkgs . rustc
53+ ] ;
4054
41- shellHook =
42- if ( ccache != null ) then
43- ''
44- export CC="${ pkgs . lib . getExe ccache } $CC"
45- export CXX="${ pkgs . lib . getExe ccache } $CXX"
46- ''
47- else
48- "" ;
55+ shellHook = pkgs . lib . optionalString ( ccache != null ) ''
56+ export CC="${ pkgs . lib . getExe ccache } $CC"
57+ export CXX="${ pkgs . lib . getExe ccache } $CXX"
58+ '' ;
4959
5060 BUILD_WITH = if ( ninja != null ) then "ninja" else "make" ;
51- NINJA = if ( ninja != null ) then "${ pkgs . lib . getExe ninja } " else " ";
61+ NINJA = pkgs . lib . optionalString ( ninja != null ) "${ pkgs . lib . getExe ninja } " ;
5262 CI_SKIP_TESTS = pkgs . lib . concatStringsSep "," (
5363 [ ]
5464 ++ pkgs . lib . optionals useSharedAda [
@@ -70,12 +80,12 @@ pkgs.mkShell {
7080 )
7181 ]
7282 ++ extraConfigFlags
73- ++ pkgs . lib . optionals ( ninja != null ) [
74- "--ninja "
75- ]
76- ++ pkgs . lib . optionals loadJSBuiltinsDynamically [
77- "--node-builtin-modules-path= ${ builtins . toString ./. } "
78- ]
83+ ++ pkgs . lib . optional ( ! withAmaro ) "--without-amaro"
84+ ++ pkgs . lib . optional ( ! withSQLite ) "--without-sqlite "
85+ ++ pkgs . lib . optional ( ! withSSL ) "--without-ssl"
86+ ++ pkgs . lib . optional withTemporal "--v8-enable-temporal-support"
87+ ++ pkgs . lib . optional ( ninja != null ) "--ninja "
88+ ++ pkgs . lib . optional loadJSBuiltinsDynamically "--node-builtin-modules-path= ${ builtins . toString ./. } "
7989 ++ pkgs . lib . concatMap ( name : [
8090 "--shared-${ builtins . replaceStrings [ "c-ares" ] [ "cares" ] name } "
8191 "--shared-${ builtins . replaceStrings [ "c-ares" ] [ "cares" ] name } -libpath=${
@@ -86,4 +96,5 @@ pkgs.mkShell {
8696 } /include"
8797 ] ) ( builtins . attrNames sharedLibDeps )
8898 ) ;
99+ NOSQLITE = pkgs . lib . optionalString ( ! withSQLite ) "1" ;
89100}
0 commit comments