terra-station: patch pre-built node modules

This commit is contained in:
Maximilian Marx 2024-04-24 01:19:24 +02:00
parent 84d675aaa9
commit bf0a52da05
No known key found for this signature in database
GPG key ID: D981CA0FF602751D

View file

@ -5,6 +5,7 @@
, bash
, makeWrapper
, electron
, asar
}:
let
@ -31,7 +32,7 @@ stdenv.mkDerivation rec {
inherit sha256;
};
nativeBuildInputs = [ makeWrapper ];
nativeBuildInputs = [ makeWrapper asar ];
dontConfigure = true;
dontBuild = true;
@ -48,6 +49,13 @@ stdenv.mkDerivation rec {
cp -a usr/share/* $out/share
cp -a "opt/Terra Station/"{locales,resources} $out/share/${pname}
# patch pre-built node modules
asar e $out/share/${pname}/resources/app.asar asar-unpacked
find asar-unpacked -name '*.node' -exec patchelf \
--add-rpath "${lib.makeLibraryPath [ stdenv.cc.cc.lib ]}" \
{} \;
asar p asar-unpacked $out/share/${pname}/resources/app.asar
substituteInPlace $out/share/applications/station-electron.desktop \
--replace "/opt/Terra Station/station-electron" ${pname}