From 84d675aaa9f9c0cad204455756e02e65ef361d29 Mon Sep 17 00:00:00 2001 From: Maximilian Marx Date: Wed, 24 Apr 2024 01:06:48 +0200 Subject: [PATCH 1/4] vesktop: patch pre-built node modules --- pkgs/by-name/ve/vesktop/package.nix | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/pkgs/by-name/ve/vesktop/package.nix b/pkgs/by-name/ve/vesktop/package.nix index 980258ed863a..dd72b9856908 100644 --- a/pkgs/by-name/ve/vesktop/package.nix +++ b/pkgs/by-name/ve/vesktop/package.nix @@ -13,6 +13,9 @@ , moreutils , cacert , nodePackages +, pipewire +, libpulseaudio +, autoPatchelfHook , withTTS ? true # Enables the use of vencord from nixpkgs instead of # letting vesktop manage it's own version @@ -81,6 +84,13 @@ stdenv.mkDerivation (finalAttrs: { nodePackages.pnpm nodePackages.nodejs makeWrapper + autoPatchelfHook + ]; + + buildInputs = [ + pipewire + libpulseaudio + stdenv.cc.cc.lib ]; patches = [ @@ -106,6 +116,7 @@ stdenv.mkDerivation (finalAttrs: { # using `pnpm exec` here apparently makes it ignore ELECTRON_SKIP_BINARY_DOWNLOAD ./node_modules/.bin/electron-builder \ --dir \ + -c.asarUnpack="**/*.node" \ -c.electronDist=${electron}/libexec/electron \ -c.electronVersion=${electron.version} ''; @@ -115,8 +126,8 @@ stdenv.mkDerivation (finalAttrs: { '' runHook preInstall - mkdir -p $out/opt/Vesktop/resources - cp dist/linux-*unpacked/resources/app.asar $out/opt/Vesktop/resources + mkdir -p $out/opt/Vesktop + cp -r dist/linux-*unpacked/resources $out/opt/Vesktop/ pushd build ${libicns}/bin/icns2png -x icon.icns From bf0a52da05410b78d159b7237896d0b4b2b9eba7 Mon Sep 17 00:00:00 2001 From: Maximilian Marx Date: Wed, 24 Apr 2024 01:19:24 +0200 Subject: [PATCH 2/4] terra-station: patch pre-built node modules --- .../applications/blockchains/terra-station/default.nix | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/pkgs/applications/blockchains/terra-station/default.nix b/pkgs/applications/blockchains/terra-station/default.nix index 5c4a7cc8b354..54ecd28550c2 100644 --- a/pkgs/applications/blockchains/terra-station/default.nix +++ b/pkgs/applications/blockchains/terra-station/default.nix @@ -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} From db8fa1117c9e8a8a4d74b14145e149db3cdff54f Mon Sep 17 00:00:00 2001 From: Maximilian Marx Date: Wed, 24 Apr 2024 01:26:52 +0200 Subject: [PATCH 3/4] standardnotes: patch pre-built node modules --- .../editors/standardnotes/default.nix | 19 +++++++++++++++++-- 1 file changed, 17 insertions(+), 2 deletions(-) diff --git a/pkgs/applications/editors/standardnotes/default.nix b/pkgs/applications/editors/standardnotes/default.nix index e61f57c76448..bc44c8e9f620 100644 --- a/pkgs/applications/editors/standardnotes/default.nix +++ b/pkgs/applications/editors/standardnotes/default.nix @@ -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 From 1c6fe6529621c8b27194e9a1e110b573ec202e9a Mon Sep 17 00:00:00 2001 From: Maximilian Marx Date: Wed, 24 Apr 2024 02:01:16 +0200 Subject: [PATCH 4/4] logseq: patch pre-built node modules --- pkgs/applications/misc/logseq/default.nix | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/pkgs/applications/misc/logseq/default.nix b/pkgs/applications/misc/logseq/default.nix index eacd64b06b55..0b316287a42d 100644 --- a/pkgs/applications/misc/logseq/default.nix +++ b/pkgs/applications/misc/logseq/default.nix @@ -5,6 +5,7 @@ , makeWrapper # graphs will not sync without matching upstream's major electron version , electron_27 +, autoPatchelfHook , git , nix-update-script }: @@ -30,7 +31,8 @@ in { dontConfigure = true; dontBuild = true; - nativeBuildInputs = [ makeWrapper ]; + nativeBuildInputs = [ makeWrapper autoPatchelfHook ]; + buildInputs = [ stdenv.cc.cc.lib ]; installPhase = '' runHook preInstall