Merge pull request #303590 from mmarx/fix-mattermost-desktop-notifications

electron: Add libnotify, pipewire, and several other runtime dependencies to RPATH; fixes desktop notifications and screenshare
This commit is contained in:
Sandro 2024-04-20 19:42:43 +02:00 committed by GitHub
commit 65d8de75bd
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
10 changed files with 35 additions and 49 deletions

View File

@ -1,6 +1,5 @@
{ lib, stdenv { lib, stdenv
, fetchurl , fetchurl
, gcc-unwrapped
, dpkg , dpkg
, util-linux , util-linux
, bash , bash
@ -57,8 +56,7 @@ stdenv.mkDerivation rec {
postFixup = '' postFixup = ''
makeWrapper ${electron}/bin/electron $out/bin/${pname} \ makeWrapper ${electron}/bin/electron $out/bin/${pname} \
--add-flags $out/share/${pname}/resources/app.asar \ --add-flags $out/share/${pname}/resources/app.aasar
--prefix LD_LIBRARY_PATH : "${lib.makeLibraryPath [ gcc-unwrapped.lib ]}"
''; '';
meta = with lib; { meta = with lib; {

View File

@ -1,5 +1,12 @@
{ lib, stdenv, fetchurl, dpkg, makeWrapper, electron, libsecret { lib
, desktop-file-utils , callPackage }: , stdenv
, fetchurl
, dpkg
, makeWrapper
, electron
, desktop-file-utils
, callPackage
}:
let let
@ -33,8 +40,7 @@ stdenv.mkDerivation rec {
cp -R opt/Standard\ Notes/resources/app.asar $out/share/standardnotes/ cp -R opt/Standard\ Notes/resources/app.asar $out/share/standardnotes/
makeWrapper ${electron}/bin/electron $out/bin/standardnotes \ makeWrapper ${electron}/bin/electron $out/bin/standardnotes \
--add-flags $out/share/standardnotes/app.asar \ --add-flags $out/share/standardnotes/app.asar
--prefix LD_LIBRARY_PATH : ${lib.makeLibraryPath [ libsecret stdenv.cc.cc.lib ]}
${desktop-file-utils}/bin/desktop-file-install --dir $out/share/applications \ ${desktop-file-utils}/bin/desktop-file-install --dir $out/share/applications \
--set-key Exec --set-value standardnotes usr/share/applications/standard-notes.desktop --set-key Exec --set-value standardnotes usr/share/applications/standard-notes.desktop

View File

@ -60,8 +60,7 @@ in {
makeWrapper ${electron_27}/bin/electron $out/bin/${pname} \ makeWrapper ${electron_27}/bin/electron $out/bin/${pname} \
--set "LOCAL_GIT_DIRECTORY" ${git} \ --set "LOCAL_GIT_DIRECTORY" ${git} \
--add-flags $out/share/${pname}/resources/app \ --add-flags $out/share/${pname}/resources/app \
--add-flags "\''${NIXOS_OZONE_WL:+\''${WAYLAND_DISPLAY:+--ozone-platform-hint=auto --enable-features=WaylandWindowDecorations}}" \ --add-flags "\''${NIXOS_OZONE_WL:+\''${WAYLAND_DISPLAY:+--ozone-platform-hint=auto --enable-features=WaylandWindowDecorations}}"
--prefix LD_LIBRARY_PATH : "${lib.makeLibraryPath [ stdenv.cc.cc.lib ]}"
''; '';
passthru.updateScript = nix-update-script { }; passthru.updateScript = nix-update-script { };

View File

@ -16,7 +16,6 @@
, AppKit , AppKit
, CoreServices , CoreServices
, desktopToDarwinBundle , desktopToDarwinBundle
, libnotify
, useKeytar ? true , useKeytar ? true
}: }:
@ -79,11 +78,6 @@ stdenv.mkDerivation (finalAttrs: builtins.removeAttrs pinData [ "hashes" ] // {
''; '';
installPhase = installPhase =
let
libPath = lib.makeLibraryPath [
libnotify
];
in
'' ''
runHook preInstall runHook preInstall
@ -111,7 +105,6 @@ stdenv.mkDerivation (finalAttrs: builtins.removeAttrs pinData [ "hashes" ] // {
# LD_PRELOAD workaround for sqlcipher not found: https://github.com/matrix-org/seshat/issues/102 # LD_PRELOAD workaround for sqlcipher not found: https://github.com/matrix-org/seshat/issues/102
makeWrapper '${electron}/bin/electron' "$out/bin/${executableName}" \ makeWrapper '${electron}/bin/electron' "$out/bin/${executableName}" \
--set LD_PRELOAD ${sqlcipher}/lib/libsqlcipher.so \ --set LD_PRELOAD ${sqlcipher}/lib/libsqlcipher.so \
--set LD_LIBRARY_PATH "${libPath}" \
--add-flags "$out/share/element/electron" \ --add-flags "$out/share/element/electron" \
--add-flags "\''${NIXOS_OZONE_WL:+\''${WAYLAND_DISPLAY:+--ozone-platform-hint=auto --enable-features=WaylandWindowDecorations}}" --add-flags "\''${NIXOS_OZONE_WL:+\''${WAYLAND_DISPLAY:+--ozone-platform-hint=auto --enable-features=WaylandWindowDecorations}}"

View File

@ -10,7 +10,6 @@
, libXtst , libXtst
, zlib , zlib
, electron , electron
, pipewire
}: }:
buildNpmPackage rec { buildNpmPackage rec {
@ -72,7 +71,6 @@ buildNpmPackage rec {
makeWrapper ${lib.getExe electron} $out/bin/jitsi-meet-electron \ makeWrapper ${lib.getExe electron} $out/bin/jitsi-meet-electron \
--add-flags $out/share/jitsi-meet-electron/resources/app.asar \ --add-flags $out/share/jitsi-meet-electron/resources/app.asar \
--prefix LD_LIBRARY_PATH : ${lib.makeLibraryPath [ pipewire ]} \
--add-flags "\''${NIXOS_OZONE_WL:+\''${WAYLAND_DISPLAY:+--ozone-platform-hint=auto --enable-features=WaylandWindowDecorations}}" \ --add-flags "\''${NIXOS_OZONE_WL:+\''${WAYLAND_DISPLAY:+--ozone-platform-hint=auto --enable-features=WaylandWindowDecorations}}" \
--inherit-argv0 --inherit-argv0

View File

@ -9,9 +9,6 @@
, fetchYarnDeps , fetchYarnDeps
, fixup-yarn-lock , fixup-yarn-lock
, electron , electron
, libnotify
, libpulseaudio
, pipewire
, alsa-utils , alsa-utils
, which , which
, testers , testers
@ -72,11 +69,10 @@ stdenv.mkDerivation (finalAttrs: {
done done
popd popd
# Linux needs 'aplay' for notification sounds, 'libpulse' for meeting sound, 'libpipewire' for screen sharing and 'libnotify' for notifications # Linux needs 'aplay' for notification sounds
makeWrapper '${electron}/bin/electron' "$out/bin/teams-for-linux" \ makeWrapper '${electron}/bin/electron' "$out/bin/teams-for-linux" \
${lib.optionalString stdenv.isLinux '' ${lib.optionalString stdenv.isLinux ''
--prefix PATH : ${lib.makeBinPath [ alsa-utils which ]} \ --prefix PATH : ${lib.makeBinPath [ alsa-utils which ]} \
--prefix LD_LIBRARY_PATH : ${lib.makeLibraryPath [ libpulseaudio pipewire libnotify ]} \
''} \ ''} \
--add-flags "$out/share/teams-for-linux/app.asar" \ --add-flags "$out/share/teams-for-linux/app.asar" \
--add-flags "\''${NIXOS_OZONE_WL:+\''${WAYLAND_DISPLAY:+--ozone-platform-hint=auto --enable-features=WaylandWindowDecorations}}" --add-flags "\''${NIXOS_OZONE_WL:+\''${WAYLAND_DISPLAY:+--ozone-platform-hint=auto --enable-features=WaylandWindowDecorations}}"

View File

@ -3,9 +3,6 @@
, fetchFromGitHub , fetchFromGitHub
, copyDesktopItems , copyDesktopItems
, python3 , python3
, pipewire
, libpulseaudio
, libnotify
, xdg-utils , xdg-utils
, electron_29 , electron_29
, makeDesktopItem , makeDesktopItem
@ -42,11 +39,6 @@ buildNpmPackage rec {
# override installPhase so we can copy the only folders that matter # override installPhase so we can copy the only folders that matter
installPhase = installPhase =
let let
libPath = lib.makeLibraryPath [
libpulseaudio
pipewire
libnotify
];
binPath = lib.makeBinPath [ xdg-utils ]; binPath = lib.makeBinPath [ xdg-utils ];
in in
'' ''
@ -62,7 +54,6 @@ buildNpmPackage rec {
# Add xdg-utils to path via suffix, per PR #181171 # Add xdg-utils to path via suffix, per PR #181171
makeWrapper '${lib.getExe electron_29}' $out/bin/webcord \ makeWrapper '${lib.getExe electron_29}' $out/bin/webcord \
--prefix LD_LIBRARY_PATH : ${libPath}:$out/opt/webcord \
--suffix PATH : "${binPath}" \ --suffix PATH : "${binPath}" \
--add-flags "\''${NIXOS_OZONE_WL:+\''${WAYLAND_DISPLAY:+--ozone-platform-hint=auto --enable-features=WaylandWindowDecorations}}" \ --add-flags "\''${NIXOS_OZONE_WL:+\''${WAYLAND_DISPLAY:+--ozone-platform-hint=auto --enable-features=WaylandWindowDecorations}}" \
--add-flags $out/lib/node_modules/webcord/ --add-flags $out/lib/node_modules/webcord/

View File

@ -38,8 +38,7 @@ stdenv.mkDerivation rec {
postFixup = '' postFixup = ''
makeWrapper ${electron}/bin/electron $out/bin/${pname} \ makeWrapper ${electron}/bin/electron $out/bin/${pname} \
--add-flags $out/share/${pname}/resources/app.asar \ --add-flags $out/share/${pname}/resources/app.asar
--prefix LD_LIBRARY_PATH : "${lib.makeLibraryPath [ stdenv.cc.cc ]}"
''; '';
meta = with lib; { meta = with lib; {

View File

@ -8,15 +8,11 @@
, copyDesktopItems , copyDesktopItems
, vencord , vencord
, electron , electron
, pipewire
, libpulseaudio
, libicns , libicns
, libnotify
, jq , jq
, moreutils , moreutils
, cacert , cacert
, nodePackages , nodePackages
, speechd
, withTTS ? true , withTTS ? true
# Enables the use of vencord from nixpkgs instead of # Enables the use of vencord from nixpkgs instead of
# letting vesktop manage it's own version # letting vesktop manage it's own version
@ -116,15 +112,6 @@ stdenv.mkDerivation (finalAttrs: {
# this is consistent with other nixpkgs electron packages and upstream, as far as I am aware # this is consistent with other nixpkgs electron packages and upstream, as far as I am aware
installPhase = installPhase =
let
# this is mainly required for venmic
libPath = lib.makeLibraryPath ([
libpulseaudio
libnotify
pipewire
stdenv.cc.cc.lib
] ++ lib.optional withTTS speechd);
in
'' ''
runHook preInstall runHook preInstall
@ -139,7 +126,6 @@ stdenv.mkDerivation (finalAttrs: {
done done
makeWrapper ${electron}/bin/electron $out/bin/vesktop \ makeWrapper ${electron}/bin/electron $out/bin/vesktop \
--prefix LD_LIBRARY_PATH : ${libPath} \
--add-flags $out/opt/Vesktop/resources/app.asar \ --add-flags $out/opt/Vesktop/resources/app.asar \
${lib.optionalString withTTS "--add-flags \"--enable-speech-dispatcher\""} \ ${lib.optionalString withTTS "--add-flags \"--enable-speech-dispatcher\""} \
--add-flags "\''${NIXOS_OZONE_WL:+\''${WAYLAND_DISPLAY:+--ozone-platform-hint=auto --enable-features=WaylandWindowDecorations}}" --add-flags "\''${NIXOS_OZONE_WL:+\''${WAYLAND_DISPLAY:+--ozone-platform-hint=auto --enable-features=WaylandWindowDecorations}}"

View File

@ -13,7 +13,10 @@
, unzip , unzip
, pkgs , pkgs
, pkgsBuildHost , pkgsBuildHost
, pipewire
, libsecret
, libpulseaudio
, speechd
, info , info
}: }:
@ -190,6 +193,23 @@ in (chromium.override { upstream-info = info.chromium; }).mkDerivation (base: {
runHook postInstall runHook postInstall
''; '';
postFixup =
let
libPath = lib.makeLibraryPath [
libnotify
pipewire
stdenv.cc.cc.lib
libsecret
libpulseaudio
speechd
];
in
base.postFixup + ''
patchelf \
--add-rpath "${libPath}" \
$out/libexec/electron/electron
'';
requiredSystemFeatures = [ "big-parallel" ]; requiredSystemFeatures = [ "big-parallel" ];
passthru = { passthru = {