vscode-js-debug: fix missing jq in postPatch

Fixes #320507.

The `npmConfigHook` used by `buildNpmPackage` does not correctly
propagate the `nativeBuildInputs` into its `PATH`, which is why `jq` was
not available during the patch phase.

Since this `npmConfigHook` is run as part of a fixed-output
derivation (`fetchNpmDeps`), if it had already been realised, unless its
hash had changed, a missing `jq` would not be noticed, on a rebuild of
`vscode-js-debug`.

The `postPatch` hook is *also* run during `buildNpmPackage`, but there
the `nativeBuildInputs` were correctly added to the `PATH`, which is why
a rebuild of `vscode-js-debug` with the previous `postPatch` would
succeed (if its `npmDeps`'s hash hadn't changed).
This commit is contained in:
Xandor Schiefer 2024-06-18 22:23:00 +02:00
parent b60ebf54c1
commit f4423979de
No known key found for this signature in database
GPG Key ID: B4A5F0674557AA6C

View File

@ -1,7 +1,7 @@
{ lib
, buildNpmPackage
, fetchFromGitHub
, jq
, buildPackages
, libsecret
, pkg-config
, nodePackages
@ -23,12 +23,12 @@ buildNpmPackage rec {
npmDepsHash = "sha256-DfeaiqKadTnGzOObK01ctlavwqTMa0tqn59sLZMPvUM=";
nativeBuildInputs = [ pkg-config nodePackages.node-gyp jq ];
nativeBuildInputs = [ pkg-config nodePackages.node-gyp ];
buildInputs = [ libsecret ];
postPatch = ''
jq '
${lib.getExe buildPackages.jq} '
.scripts.postinstall |= empty | # tries to install playwright, not necessary for build
.scripts.build |= "gulp dapDebugServer" | # there is no build script defined
.bin |= "./dist/src/dapDebugServer.js" # there is no bin output defined