signal-desktop: dont hold onto nodejs at all

This commit is contained in:
2025-07-06 08:25:22 +00:00
parent c4f25ac198
commit 019991cf1e

View File

@@ -676,20 +676,18 @@ in with final; {
["${lib.optionalString stdenv.hostPlatform.isAarch64 "--arm64 "}-c.electronDist"] ["${lib.optionalString stdenv.hostPlatform.isAarch64 "--arm64 "}-c.electronDist"]
upstream.buildPhase upstream.buildPhase
; ;
# fixup the app.asar to use the host nodejs. # fixup the app.asar to not hold a ref to any build-time tools
# XXX(2025-07-06): this seems to not actually be necessary; it launches fine unpatched.
# probably better to just remove these references?
nativeBuildInputs = upstream.nativeBuildInputs ++ [ nativeBuildInputs = upstream.nativeBuildInputs ++ [
final.asar final.asar
]; final.removeReferencesTo
buildInputs = upstream.buildInputs ++ [
final.bash # node_modules/pino/inc-version.sh has `#!/bin/bash` as shebang; gets patched to the build one, but still appears in the shipped asar.
final.nodejs_22
]; ];
preFixup = (upstream.preFixup or "") + '' preFixup = (upstream.preFixup or "") + ''
# the asar includes both runtime and build-time files (e.g. build scripts):
# it's impractical to properly split out the node files which aren't needed at runtime,
# but we can patch them to not refer to the build tools to reduce closure size and to make potential packaging/cross-compilation bugs more obvious.
asar extract $out/share/signal-desktop/app.asar asar-unpacked asar extract $out/share/signal-desktop/app.asar asar-unpacked
rm $out/share/signal-desktop/app.asar rm $out/share/signal-desktop/app.asar
patchShebangs --host --update asar-unpacked find asar-unpacked/node_modules -type f -executable -exec remove-references-to -t ${buildPackages.nodejs_22} -t ${buildPackages.bashNonInteractive} '{}' \;
asar pack asar-unpacked $out/share/signal-desktop/app.asar asar pack asar-unpacked $out/share/signal-desktop/app.asar
''; '';
}); });