2323} :
2424
2525let
26- v8Dir = ../../deps/v8 ;
26+ src =
27+ let
28+ inherit ( lib ) fileset ;
29+ root = ../../. ;
30+ files = [
31+ ../../common.gypi
32+ ../../configure.py
33+ ../../deps/v8
34+ ../../node.gyp
35+ ../../node.gypi
36+ ../../src/node_version.h
37+ ../../tools/configure.d/nodedownload.py
38+ ../../tools/getmoduleversion.py
39+ ../../tools/getnapibuildversion.py
40+ ../../tools/gyp/pylib
41+ ../../tools/gyp_node.py
42+ ../../tools/utils.py
43+ ../../tools/v8_gypfiles/abseil.gyp
44+ ../../tools/v8_gypfiles/features.gypi
45+ ../../tools/v8_gypfiles/ForEachFormat.py
46+ ../../tools/v8_gypfiles/ForEachReplace.py
47+ ../../tools/v8_gypfiles/GN-scraper.py
48+ ../../tools/v8_gypfiles/inspector.gypi
49+ ../../tools/v8_gypfiles/toolchain.gypi
50+ ../../tools/v8_gypfiles/v8.gyp
51+ ]
52+ ++ lib . optionals ( icu != null ) [
53+ ../../tools/icu/icu_versions.json
54+ ../../tools/icu/icu-system.gyp
55+ ]
56+ ++ lib . optionals ( icu == "small" ) [
57+ ../../deps/icu-small
58+ ../../tools/icu/current_ver.dep
59+ ../../tools/icu/icu_small.json
60+ ../../tools/icu/icu-generic.gyp
61+ ../../tools/icu/iculslocs.cc
62+ ../../tools/icu/icutrim.py
63+ ../../tools/icu/no-op.cc
64+ ] ;
65+ in
66+ fileset . toSource {
67+ inherit root ;
68+ fileset = fileset . intersection ( fileset . gitTracked root ) ( fileset . unions files ) ;
69+ } ;
70+ v8Dir = "${ src } /deps/v8" ;
2771in
2872stdenv . mkDerivation ( finalAttrs : {
2973 pname = "v8" ;
@@ -36,64 +80,20 @@ stdenv.mkDerivation (finalAttrs: {
3680 + "#define V8_PATCH_LEVEL ([0-9]+).*"
3781 ) ( builtins . readFile "${ v8Dir } /include/v8-version.h" ) ;
3882 v8_embedder_string = builtins . match ".*'v8_embedder_string': '-(node.[0-9]+)'.*" (
39- builtins . readFile ../../ common.gypi
83+ builtins . readFile " ${ src } / common.gypi"
4084 ) ;
4185 in
4286 if v8Version == null || v8_embedder_string == null then
4387 throw "V8 version not found"
4488 else
4589 "${ builtins . elemAt v8Version 0 } .${ builtins . elemAt v8Version 1 } .${ builtins . elemAt v8Version 2 } .${ builtins . elemAt v8Version 3 } -${ builtins . elemAt v8_embedder_string 0 } " ;
46- src =
47- let
48- inherit ( lib ) fileset ;
49- in
50- fileset . toSource {
51- root = ../../. ;
52- fileset = fileset . unions (
53- [
54- v8Dir
55- ../../common.gypi
56- ../../configure.py
57- ../../node.gyp
58- ../../node.gypi
59- ../../src/node_version.h
60- ../../tools/configure.d/nodedownload.py
61- ../../tools/getmoduleversion.py
62- ../../tools/getnapibuildversion.py
63- ../../tools/gyp_node.py
64- ../../tools/utils.py
65- ../../tools/v8_gypfiles/abseil.gyp
66- ../../tools/v8_gypfiles/features.gypi
67- ../../tools/v8_gypfiles/ForEachFormat.py
68- ../../tools/v8_gypfiles/ForEachReplace.py
69- ../../tools/v8_gypfiles/GN-scraper.py
70- ../../tools/v8_gypfiles/inspector.gypi
71- ../../tools/v8_gypfiles/toolchain.gypi
72- ../../tools/v8_gypfiles/v8.gyp
73- ]
74- ++ lib . optionals ( icu != null ) [
75- ../../tools/icu/icu_versions.json
76- ../../tools/icu/icu-system.gyp
77- ]
78- ++ lib . optionals ( icu == "small" ) [
79- ../../deps/icu-small
80- ../../tools/icu/current_ver.dep
81- ../../tools/icu/icu_small.json
82- ../../tools/icu/icu-generic.gyp
83- ../../tools/icu/iculslocs.cc
84- ../../tools/icu/icutrim.py
85- ../../tools/icu/no-op.cc
86- ]
87- ) ;
88- } ;
8990
9091 patches = lib . optional (
9192 # V8 accesses internal ICU headers and methods in the Temporal files.
9293 ! ( builtins . isString icu ) && builtins . elem "--v8-enable-temporal-support" configureFlags
9394 ) ./temporal-no-vendored-icu.patch ;
9495
95- # We need to download and patch GYP to work from within Nix sandbox
96- # and so the local pycache does not pollute the hash.
96+ # We need to patch tools/gyp/ to work from within Nix sandbox
9797 prePatch = ''
9898 ${ lib . optionalString ( builtins . length finalAttrs . patches == 0 ) "patches=()" }
9999 for patch in ${ lib . concatStringsSep " " patches } ; do
@@ -103,8 +103,6 @@ stdenv.mkDerivation (finalAttrs: {
103103 patches+=("$filtered")
104104 fi
105105 done
106- tar -C tools -xzf ${ import ../../tools/gyp/src.nix } --wildcards 'gyp-*/pylib'
107- mv tools/gyp-* tools/gyp
108106 '' ;
109107 # We need to remove the node_inspector.gypi ref so GYP does not search for it.
110108 postPatch = ''
@@ -117,7 +115,12 @@ stdenv.mkDerivation (finalAttrs: {
117115 "icu_versions = { 'minimum_icu': 1 }"
118116 '' ;
119117
120- inherit configureScript configureFlags buildInputs ;
118+ inherit
119+ src
120+ configureScript
121+ configureFlags
122+ buildInputs
123+ ;
121124
122125 nativeBuildInputs = nativeBuildInputs ++ [
123126 patchutils
0 commit comments