standardnotes: patch pre-built node modules

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

View file

@ -4,6 +4,9 @@
, dpkg
, makeWrapper
, electron
, libsecret
, asar
, glib
, desktop-file-utils
, callPackage
}:
@ -28,16 +31,28 @@ stdenv.mkDerivation rec {
dontBuild = true;
nativeBuildInputs = [ makeWrapper dpkg desktop-file-utils ];
nativeBuildInputs = [ makeWrapper dpkg desktop-file-utils asar ];
unpackPhase = "dpkg-deb --fsys-tarfile $src | tar -x --no-same-permissions --no-same-owner";
installPhase = ''
installPhase = let
libPath = lib.makeLibraryPath [
libsecret
glib
stdenv.cc.cc.lib
];
in
''
runHook preInstall
mkdir -p $out/bin $out/share/standardnotes
cp -R usr/share/{applications,icons} $out/share
cp -R opt/Standard\ Notes/resources/app.asar $out/share/standardnotes/
asar e $out/share/standardnotes/app.asar asar-unpacked
find asar-unpacked -name '*.node' -exec patchelf \
--add-rpath "${libPath}" \
{} \;
asar p asar-unpacked $out/share/standardnotes/app.asar
makeWrapper ${electron}/bin/electron $out/bin/standardnotes \
--add-flags $out/share/standardnotes/app.asar