Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Backport release-24.05] telegram-desktop: 5.1.7 -> 5.5.5 #342783

Open
wants to merge 25 commits into
base: release-24.05
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
25 commits
Select commit Hold shift + click to select a range
50160b9
telegram-desktop: add missing glib-networking dependency
NickCao May 27, 2024
858c635
telegram-desktop.tg_owt: 0-unstable-2023-12-21 -> 0-unstable-2024-06-15
oxalica Jun 15, 2024
36768d9
telegram-desktop: 5.1.7 -> 5.1.8
r-ryantm Jun 23, 2024
4f6ca97
telegram-desktop: 5.1.8 -> 5.2.0
NickCao Jul 1, 2024
e7a1434
telegram-desktop: 5.2.0 -> 5.2.1
NickCao Jul 1, 2024
e1afe9b
telegram-desktop: 5.2.1 -> 5.2.2
NickCao Jul 2, 2024
57afe6e
telegram-desktop: depends on LocalAuthentication on darwin platforms
NickCao Jul 2, 2024
0dde43e
telegram-desktop: update patch for disabling url scheme registration
NickCao Jul 3, 2024
a09ed13
telegram-desktop: use finalAttrs pattern to simplify packaging tdeskt…
NickCao Jul 4, 2024
a12bf81
telegram-desktop: 5.2.2 -> 5.2.3
r-ryantm Jul 20, 2024
70dab1a
telegram-desktop.tg_owt: 0-unstable-2024-06-15 -> 0-unstable-2024-07-30
NickCao Aug 1, 2024
7a776fd
telegram-desktop.tg_owt: 0-unstable-2024-07-30 -> 0-unstable-2024-08-02
NickCao Aug 2, 2024
6c22308
telegram-desktop: 5.2.3 -> 5.3.0
NickCao Jul 31, 2024
5d4b328
ada: init at 2.9.0
NickCao Aug 1, 2024
d4cbf0b
ada: 2.9.0 -> 2.9.1
r-ryantm Aug 25, 2024
6b9087b
ada: 2.9.1 -> 2.9.2
NickCao Sep 3, 2024
9753141
telegram-desktop: 5.3.0 -> 5.3.1
NickCao Aug 1, 2024
0eec583
telegram-desktop: 5.3.1 -> 5.3.2
NickCao Aug 2, 2024
30486cf
telegram-desktop.tg_owt: 0-unstable-2024-08-02 -> 0-unstable-2024-08-04
NickCao Aug 15, 2024
41e160c
telegram-desktop: 5.3.2 -> 5.4.0
NickCao Aug 15, 2024
0aeec84
telegram-desktop: 5.4.0 -> 5.4.1
NickCao Aug 17, 2024
da63ebd
telegram-desktop: 5.4.1 -> 5.5.0
NickCao Sep 6, 2024
088498f
telegram-desktop: 5.5.0 -> 5.5.1
NickCao Sep 6, 2024
53f1e45
telegram-desktop: 5.5.1 -> 5.5.2
NickCao Sep 9, 2024
2b7ea15
telegram-desktop: 5.5.2 -> 5.5.5
r-ryantm Sep 18, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
{ lib
, fetchFromGitHub
, fetchpatch
, callPackage
, pkg-config
, cmake
Expand All @@ -15,6 +14,7 @@
, qtsvg
, qtimageformats
, gtk3
, glib-networking
, boost
, fmt
, libdbusmenu
Expand All @@ -38,6 +38,7 @@
, xdg-utils
, microsoft-gsl
, rlottie
, ada
, stdenv
, darwin
, lld
Expand All @@ -59,29 +60,25 @@ let
cxxStandard = "20";
};
};
mainProgram = if stdenv.isLinux then "telegram-desktop" else "Telegram";
in
stdenv.mkDerivation rec {
stdenv.mkDerivation (finalAttrs: {
pname = "telegram-desktop";
version = "5.1.7";
version = "5.5.5";

src = fetchFromGitHub {
owner = "telegramdesktop";
repo = "tdesktop";
rev = "v${version}";
rev = "v${finalAttrs.version}";
fetchSubmodules = true;
hash = "sha256-OH9+cH5CQyrp4DSKXEMs6csGiH+GAtxJT4P9YidmAcM=";
hash = "sha256-LWIOgyHp43bLN4RQtBKH2HitfVI6AKstPK5es2s+wVw=";
};

patches = [
./macos.patch
# the generated .desktop files contains references to unwrapped tdesktop, breaking scheme handling
# and the scheme handler is already registered in the packaged .desktop file, rendering this unnecessary
# see https://github.com/NixOS/nixpkgs/issues/218370
(fetchpatch {
url = "https://salsa.debian.org/debian/telegram-desktop/-/raw/09b363ed5a4fcd8ecc3282b9bfede5fbb83f97ef/debian/patches/Disable-register-custom-scheme.patch";
hash = "sha256-B8X5lnSpwwdp1HlvyXJWQPybEN+plOwimdV5gW6aY2Y=";
})
./scheme.patch
];

postPatch = lib.optionalString stdenv.isLinux ''
Expand Down Expand Up @@ -134,9 +131,11 @@ stdenv.mkDerivation rec {
tg_owt
microsoft-gsl
rlottie
ada
] ++ lib.optionals stdenv.isLinux [
qtwayland
gtk3
glib-networking
fmt
libdbusmenu
alsa-lib
Expand Down Expand Up @@ -177,6 +176,7 @@ stdenv.mkDerivation rec {
IOSurface
Metal
NaturalLanguage
LocalAuthentication
libicns
]);

Expand All @@ -185,13 +185,12 @@ stdenv.mkDerivation rec {
};

cmakeFlags = [
"-Ddisable_autoupdate=ON"
(lib.cmakeBool "DESKTOP_APP_DISABLE_AUTOUPDATE" true)
# We're allowed to used the API ID of the Snap package:
"-DTDESKTOP_API_ID=611335"
"-DTDESKTOP_API_HASH=d524b414d21f4d37f08684c1df41ac9c"
(lib.cmakeFeature "TDESKTOP_API_ID" "611335")
(lib.cmakeFeature "TDESKTOP_API_HASH" "d524b414d21f4d37f08684c1df41ac9c")
# See: https://github.com/NixOS/nixpkgs/pull/130827#issuecomment-885212649
"-DDESKTOP_APP_USE_PACKAGED_FONTS=OFF"
"-DDESKTOP_APP_DISABLE_SCUDO=ON"
(lib.cmakeBool "DESKTOP_APP_USE_PACKAGED_FONTS" false)
];

preBuild = ''
Expand All @@ -201,37 +200,37 @@ stdenv.mkDerivation rec {

installPhase = lib.optionalString stdenv.isDarwin ''
mkdir -p $out/Applications
cp -r ${mainProgram}.app $out/Applications
ln -s $out/{Applications/${mainProgram}.app/Contents/MacOS,bin}
cp -r ${finalAttrs.meta.mainProgram}.app $out/Applications
ln -s $out/{Applications/${finalAttrs.meta.mainProgram}.app/Contents/MacOS,bin}
'';

postFixup = lib.optionalString stdenv.isLinux ''
# This is necessary to run Telegram in a pure environment.
# We also use gappsWrapperArgs from wrapGAppsHook.
wrapProgram $out/bin/${mainProgram} \
wrapProgram $out/bin/${finalAttrs.meta.mainProgram} \
"''${gappsWrapperArgs[@]}" \
"''${qtWrapperArgs[@]}" \
--suffix PATH : ${lib.makeBinPath [ xdg-utils ]}
'' + lib.optionalString stdenv.isDarwin ''
wrapQtApp $out/Applications/${mainProgram}.app/Contents/MacOS/${mainProgram}
wrapQtApp $out/Applications/${finalAttrs.meta.mainProgram}.app/Contents/MacOS/${finalAttrs.meta.mainProgram}
'';

passthru = {
inherit tg_owt;
updateScript = nix-update-script { };
};

meta = with lib; {
meta = {
description = "Telegram Desktop messaging app";
longDescription = ''
Desktop client for the Telegram messenger, based on the Telegram API and
the MTProto secure protocol.
'';
license = licenses.gpl3Only;
platforms = platforms.all;
license = lib.licenses.gpl3Only;
platforms = lib.platforms.all;
homepage = "https://desktop.telegram.org/";
changelog = "https://github.com/telegramdesktop/tdesktop/releases/tag/v${version}";
maintainers = with maintainers; [ nickcao ];
inherit mainProgram;
changelog = "https://github.com/telegramdesktop/tdesktop/releases/tag/v${finalAttrs.version}";
maintainers = with lib.maintainers; [ nickcao ];
mainProgram = if stdenv.hostPlatform.isLinux then "telegram-desktop" else "Telegram";
};
}
})
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
diff --git a/Telegram/SourceFiles/core/application.cpp b/Telegram/SourceFiles/core/application.cpp
index e3e0de6c6..d5851bd6e 100644
--- a/Telegram/SourceFiles/core/application.cpp
+++ b/Telegram/SourceFiles/core/application.cpp
@@ -421,7 +421,6 @@ void Application::run() {

void Application::autoRegisterUrlScheme() {
if (!OptionSkipUrlSchemeRegister.value()) {
- InvokeQueued(this, [] { RegisterUrlScheme(); });
}
}

Original file line number Diff line number Diff line change
@@ -1,79 +1,117 @@
{ lib, stdenv, fetchFromGitHub, fetchpatch
, pkg-config, cmake, ninja, yasm
, libjpeg, openssl, libopus, ffmpeg, alsa-lib, libpulseaudio, protobuf
, openh264, usrsctp, libevent, libvpx
, libX11, libXtst, libXcomposite, libXdamage, libXext, libXrender, libXrandr, libXi
, glib, abseil-cpp, pcre, util-linuxMinimal, libselinux, libsepol, pipewire
, mesa, libepoxy, libglvnd, unstableGitUpdater, darwin
{
lib,
stdenv,
fetchFromGitHub,
pkg-config,
cmake,
crc32c,
python3,
libjpeg,
openssl,
libopus,
ffmpeg,
openh264,
libvpx,
libXi,
libXfixes,
libXtst,
libXcomposite,
libXdamage,
libXext,
libXrender,
libXrandr,
glib,
abseil-cpp,
pipewire,
mesa,
libGL,
unstableGitUpdater,
darwin,
}:

stdenv.mkDerivation {
pname = "tg_owt";
version = "0-unstable-2023-12-21";
version = "0-unstable-2024-08-04";

src = fetchFromGitHub {
owner = "desktop-app";
repo = "tg_owt";
rev = "afd9d5d31798d3eacf9ed6c30601e91d0f1e4d60";
sha256 = "sha256-/1cghoxmm+6uFEUgCjh1Xhb0CTnd1XAq1M21FruDRek=";
rev = "dc17143230b5519f3c1a8da0079e00566bd4c5a8";
sha256 = "sha256-7j7hBIOXEdNJDnDSVUqy234nkTCaeZ9tDAzqvcuaq0o=";
fetchSubmodules = true;
};

outputs = [ "out" "dev" ];
outputs = [
"out"
"dev"
];

nativeBuildInputs = [ pkg-config cmake ninja yasm ];
nativeBuildInputs = [
cmake
pkg-config
python3
];

buildInputs = [
libjpeg libopus ffmpeg protobuf openh264 usrsctp libevent libvpx abseil-cpp
] ++ lib.optionals stdenv.isLinux [
libX11 libXtst libXcomposite libXdamage libXext libXrender libXrandr libXi
glib pcre util-linuxMinimal libselinux libsepol pipewire alsa-lib libpulseaudio
mesa libepoxy libglvnd
] ++ lib.optionals stdenv.isDarwin (with darwin.apple_sdk.frameworks; [
Cocoa
AppKit
IOKit
IOSurface
Foundation
AVFoundation
CoreMedia
VideoToolbox
CoreGraphics
CoreVideo
OpenGL
Metal
MetalKit
CoreFoundation
ApplicationServices
]);
buildInputs =
[
openssl
libjpeg
libopus
ffmpeg
]
++ lib.optionals stdenv.hostPlatform.isLinux [
glib
libXi
libXcomposite
libXdamage
libXext
libXfixes
libXrender
libXrandr
libXtst
pipewire
mesa
libGL
]
++ lib.optionals stdenv.hostPlatform.isDarwin (
with darwin.apple_sdk.frameworks;
[
Cocoa
AppKit
IOKit
IOSurface
Foundation
AVFoundation
CoreMedia
VideoToolbox
CoreGraphics
CoreVideo
Metal
MetalKit
CoreFoundation
ApplicationServices
]
);

patches = [
# GCC 12 Fix
(fetchpatch {
url = "https://github.com/desktop-app/tg_owt/pull/101/commits/86d2bcd7afb8706663d29e30f65863de5a626142.patch";
hash = "sha256-iWS0mB8R0vqPU/0qf6Ax54UCAKYDVCPac2mi/VHbFm0=";
})
# additional fix for GCC 12 + musl
(fetchpatch {
url = "https://git.alpinelinux.org/aports/plain/community/tg_owt/gcc12.patch?id=8120df03fa3b6db5b8ff92c7a52b680290ad6e20";
hash = "sha256-ikgxUH1e7pz0n0pKUemrPXXa4UkECX+w467M9gU68zs=";
})
propagatedBuildInputs = [
abseil-cpp
crc32c
openh264
libvpx
];

cmakeFlags = [
# Building as a shared library isn't officially supported and may break at any time.
"-DBUILD_SHARED_LIBS=OFF"
];

propagatedBuildInputs = [
# Required for linking downstream binaries.
abseil-cpp openh264 usrsctp libevent libvpx openssl
(lib.cmakeBool "BUILD_SHARED_LIBS" false)
];

passthru.updateScript = unstableGitUpdater { };

meta = with lib; {
license = licenses.bsd3;
maintainers = with maintainers; [ oxalica ];
meta = {
description = "Fork of Google's webrtc library for telegram-desktop";
homepage = "https://github.com/desktop-app/tg_owt";
license = lib.licenses.bsd3;
maintainers = with lib.maintainers; [ oxalica ];
platforms = lib.platforms.linux ++ lib.platforms.darwin;
};
}
37 changes: 37 additions & 0 deletions pkgs/by-name/ad/ada/package.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
{
lib,
stdenv,
fetchFromGitHub,
cmake,
}:

stdenv.mkDerivation rec {
pname = "ada";
version = "2.9.2";

src = fetchFromGitHub {
owner = "ada-url";
repo = "ada";
rev = "v${version}";
hash = "sha256-VWFxupmgc+fq9aj/02uMEsiwhP+9PWMSleoIoyKVe3c=";
};

nativeBuildInputs = [ cmake ];

cmakeFlags = [
# uses CPM that requires network access
(lib.cmakeBool "ADA_TOOLS" false)
(lib.cmakeBool "ADA_TESTING" false)
];

meta = {
description = "WHATWG-compliant and fast URL parser written in modern C";
homepage = "https://github.com/ada-url/ada";
license = with lib.licenses; [
asl20
mit
];
maintainers = with lib.maintainers; [ nickcao ];
platforms = lib.platforms.all;
};
}