Skip to content

Commit 92d8e11

Browse files
committed
tools: add v8.nix to Nix diff checker
Signed-off-by: Antoine du Hamel <duhamelantoine1995@gmail.com>
1 parent e463b48 commit 92d8e11

3 files changed

Lines changed: 24 additions & 16 deletions

File tree

‎.github/workflows/test-shared.yml‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -199,7 +199,7 @@ jobs:
199199
id: v8-drv
200200
run: |
201201
V8_DRV=$(
202-
nix-instantiate -E "builtins.filter (p: p.pname == ''v8'') (import $TAR_DIR/tools/nix/ci-shell.nix {}).buildInputs"
202+
nix-instantiate -E "(import $TAR_DIR/tools/nix/ci-shell.nix {}).v8Derivation"
203203
)
204204
V8_STORE_PATH=$(nix-store -q --outputs "$V8_DRV")
205205
echo "V8_DRV=$V8_DRV" >> "$GITHUB_OUTPUT"

‎shell.nix‎

Lines changed: 19 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -88,6 +88,20 @@ let
8888
]
8989
++ builtins.map (depName: "--shared-${depName}") sharedV8Deps
9090
++ pkgs.lib.optional withPerfetto "--with-perfetto";
91+
92+
v8Derivation =
93+
if useSeparateDerivationForV8 == true then
94+
let
95+
sharedLibsToMock = pkgs.callPackage ./tools/nix/non-v8-deps-mock.nix { };
96+
in
97+
pkgs.callPackage ./tools/nix/v8.nix {
98+
inherit nativeBuildInputs icu;
99+
100+
configureFlags = configureFlags ++ sharedLibsToMock.configureFlags ++ [ "--ninja" ];
101+
buildInputs = buildInputs ++ [ sharedLibsToMock ];
102+
}
103+
else
104+
useSeparateDerivationForV8;
91105
in
92106
pkgs.mkShell {
93107
inherit nativeBuildInputs;
@@ -98,20 +112,7 @@ pkgs.mkShell {
98112
buildInputs =
99113
builtins.attrValues sharedLibDeps
100114
++ buildInputs
101-
++ pkgs.lib.optional (useSeparateDerivationForV8 != false) (
102-
if useSeparateDerivationForV8 == true then
103-
let
104-
sharedLibsToMock = pkgs.callPackage ./tools/nix/non-v8-deps-mock.nix { };
105-
in
106-
pkgs.callPackage ./tools/nix/v8.nix {
107-
inherit nativeBuildInputs icu;
108-
109-
configureFlags = configureFlags ++ sharedLibsToMock.configureFlags ++ [ "--ninja" ];
110-
buildInputs = buildInputs ++ [ sharedLibsToMock ];
111-
}
112-
else
113-
useSeparateDerivationForV8
114-
);
115+
++ pkgs.lib.optional (useSeparateDerivationForV8 != false) v8Derivation;
115116

116117
packages = devTools ++ benchmarkTools ++ pkgs.lib.optional (ccache != null) ccache;
117118

@@ -120,6 +121,10 @@ pkgs.mkShell {
120121
export CXX="${pkgs.lib.getExe ccache} $CXX"
121122
'';
122123

124+
passthru = {
125+
inherit v8Derivation;
126+
};
127+
123128
env = {
124129
BUILD_WITH = if (ninja != null) then "ninja" else "make";
125130
NINJA = pkgs.lib.optionalString (ninja != null) "${pkgs.lib.getExe ninja}";

‎tools/nix/list-requisites.sh‎

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,4 +59,7 @@ REFS=$(nix-store --query --references "$DRV")
5959
STORE_PATHS=$(echo "$REFS" | xargs nix-store --realise)
6060
REQUISITES=$(echo "$STORE_PATHS" | xargs nix-store --query --requisites)
6161

62-
echo "$REQUISITES" | sort -k1.45 | uniq
62+
V8_DRV=$(nix-instantiate -E "(import $BASE_DIR/tools/nix/ci-shell.nix {}).v8Derivation")
63+
V8_STORE_PATH=$(nix-store -q --outputs "$V8_DRV")
64+
65+
printf '%s\n%s\n' "$REQUISITES" "$V8_STORE_PATH" | sort -k1.45 | uniq

0 commit comments

Comments
 (0)