From 0006f72f880bc2cd02b0f95a931ffa9ae2e4abc3 Mon Sep 17 00:00:00 2001 From: oxalica Date: Wed, 21 Jul 2021 00:11:21 +0800 Subject: [PATCH 1/3] tdesktop: use bundled libtgvoip (cherry picked from commit 2a12ba467c49bd8885f3726fca061574a4d816cb) --- .../instant-messengers/telegram/tdesktop/default.nix | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/pkgs/applications/networking/instant-messengers/telegram/tdesktop/default.nix b/pkgs/applications/networking/instant-messengers/telegram/tdesktop/default.nix index 27af9698788..9766a198732 100644 --- a/pkgs/applications/networking/instant-messengers/telegram/tdesktop/default.nix +++ b/pkgs/applications/networking/instant-messengers/telegram/tdesktop/default.nix @@ -2,7 +2,7 @@ , pkg-config, cmake, ninja, python3, wrapGAppsHook, wrapQtAppsHook, removeReferencesTo , qtbase, qtimageformats, gtk3, libsForQt5, enchant2, lz4, xxHash , dee, ffmpeg, openalSoft, minizip, libopus, alsaLib, libpulseaudio, range-v3 -, tl-expected, hunspell, glibmm, webkitgtk, libtgvoip +, tl-expected, hunspell, glibmm, webkitgtk # Transitive dependencies: , pcre, xorg, util-linux, libselinux, libsepol, epoxy , at-spi2-core, libXtst, libthai, libdatrie @@ -59,7 +59,7 @@ in mkDerivation rec { qtbase qtimageformats gtk3 libsForQt5.kwayland libsForQt5.libdbusmenu enchant2 lz4 xxHash dee ffmpeg openalSoft minizip libopus alsaLib libpulseaudio range-v3 tl-expected hunspell glibmm webkitgtk - tg_owt libtgvoip + tg_owt # Transitive dependencies: pcre xorg.libpthreadstubs xorg.libXdmcp util-linux libselinux libsepol epoxy at-spi2-core libXtst libthai libdatrie libsysprof-capture libpsl brotli @@ -70,7 +70,6 @@ in mkDerivation rec { # We're allowed to used the API ID of the Snap package: "-DTDESKTOP_API_ID=611335" "-DTDESKTOP_API_HASH=d524b414d21f4d37f08684c1df41ac9c" - #"-DDESKTOP_APP_SPECIAL_TARGET=\"\"" # TODO: Error when set to "": Bad special target '""' "-DTDESKTOP_LAUNCHER_BASENAME=telegramdesktop" # Note: This is the default ]; @@ -115,7 +114,7 @@ in mkDerivation rec { license = licenses.gpl3; platforms = platforms.linux; homepage = "https://desktop.telegram.org/"; - changelog = "https://github.com/telegramdesktop/tdesktop/releases/tag/v{version}"; - maintainers = with maintainers; [ primeos abbradar ]; + changelog = "https://github.com/telegramdesktop/tdesktop/releases/tag/v${version}"; + maintainers = with maintainers; [ primeos abbradar oxalica ]; }; } From e0952c6afdc9dd0e4c5ebdb049ab2d3f8fc1a3bf Mon Sep 17 00:00:00 2001 From: oxalica Date: Fri, 23 Jul 2021 05:15:37 +0800 Subject: [PATCH 2/3] tdesktop: patch dlopen paths (cherry picked from commit 6019d8abff9e4cc31001d2b9a55088bdefa245cd) --- .../instant-messengers/telegram/tdesktop/default.nix | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/pkgs/applications/networking/instant-messengers/telegram/tdesktop/default.nix b/pkgs/applications/networking/instant-messengers/telegram/tdesktop/default.nix index 9766a198732..32f0b480fb4 100644 --- a/pkgs/applications/networking/instant-messengers/telegram/tdesktop/default.nix +++ b/pkgs/applications/networking/instant-messengers/telegram/tdesktop/default.nix @@ -47,6 +47,13 @@ in mkDerivation rec { --replace '"libenchant-2.so.2"' '"${enchant2}/lib/libenchant-2.so.2"' substituteInPlace Telegram/CMakeLists.txt \ --replace '"''${TDESKTOP_LAUNCHER_BASENAME}.appdata.xml"' '"''${TDESKTOP_LAUNCHER_BASENAME}.metainfo.xml"' + + substituteInPlace Telegram/ThirdParty/libtgvoip/os/linux/AudioInputALSA.cpp \ + --replace '"libasound.so.2"' '"${alsaLib}/lib/libasound.so.2"' + substituteInPlace Telegram/ThirdParty/libtgvoip/os/linux/AudioOutputALSA.cpp \ + --replace '"libasound.so.2"' '"${alsaLib}/lib/libasound.so.2"' + substituteInPlace Telegram/ThirdParty/libtgvoip/os/linux/AudioPulse.cpp \ + --replace '"libpulse.so.0"' '"${libpulseaudio}/lib/libpulse.so.0"' ''; # We want to run wrapProgram manually (with additional parameters) From 18f9a94bcd4d54e145462f292963af7aae1d8c94 Mon Sep 17 00:00:00 2001 From: oxalica Date: Fri, 23 Jul 2021 05:17:14 +0800 Subject: [PATCH 3/3] tdesktop: bundle the default font It's worth to think about setting -DDESKTOP_APP_USE_PACKAGED_FONTS=OFF since it's impossible to install fonts as dependencies of packages with Nix and tdesktop's widgets are developed only with Open Sans in mind (it has a lot of hardcoded values and wide fonts like DejaVu may even go out of widgets' bounds) https://github.com/NixOS/nixpkgs/pull/130827#issuecomment-885212649 (cherry picked from commit 27585b98971f8180e12592e694d38a19c072d1bf) --- .../networking/instant-messengers/telegram/tdesktop/default.nix | 2 ++ 1 file changed, 2 insertions(+) diff --git a/pkgs/applications/networking/instant-messengers/telegram/tdesktop/default.nix b/pkgs/applications/networking/instant-messengers/telegram/tdesktop/default.nix index 32f0b480fb4..5997de14edb 100644 --- a/pkgs/applications/networking/instant-messengers/telegram/tdesktop/default.nix +++ b/pkgs/applications/networking/instant-messengers/telegram/tdesktop/default.nix @@ -78,6 +78,8 @@ in mkDerivation rec { "-DTDESKTOP_API_ID=611335" "-DTDESKTOP_API_HASH=d524b414d21f4d37f08684c1df41ac9c" "-DTDESKTOP_LAUNCHER_BASENAME=telegramdesktop" # Note: This is the default + # See: https://github.com/NixOS/nixpkgs/pull/130827#issuecomment-885212649 + "-DDESKTOP_APP_USE_PACKAGED_FONTS=OFF" ]; # Note: The following packages could be packaged system-wide, but it's