summary refs log tree commit diff
path: root/pkgs/applications/networking/instant-messengers/telegram/tdesktop
diff options
context:
space:
mode:
authorSandro Jäckel <sandro.jaeckel@gmail.com>2023-04-07 16:46:39 +0200
committerSandro Jäckel <sandro.jaeckel@gmail.com>2023-04-07 16:46:39 +0200
commite6c5f4cff886a131b74be494405e0d6a4c740518 (patch)
treee93eed2dde4cb0c6fa5a0354c2ea68e41ee02938 /pkgs/applications/networking/instant-messengers/telegram/tdesktop
parentc816bd50aa41bd3ab4adfeb62ac918566076d59f (diff)
downloadnixpkgs-e6c5f4cff886a131b74be494405e0d6a4c740518.tar
nixpkgs-e6c5f4cff886a131b74be494405e0d6a4c740518.tar.gz
nixpkgs-e6c5f4cff886a131b74be494405e0d6a4c740518.tar.bz2
nixpkgs-e6c5f4cff886a131b74be494405e0d6a4c740518.tar.lz
nixpkgs-e6c5f4cff886a131b74be494405e0d6a4c740518.tar.xz
nixpkgs-e6c5f4cff886a131b74be494405e0d6a4c740518.tar.zst
nixpkgs-e6c5f4cff886a131b74be494405e0d6a4c740518.zip
telegram-desktop: rename from tdesktop
Diffstat (limited to 'pkgs/applications/networking/instant-messengers/telegram/tdesktop')
-rw-r--r--pkgs/applications/networking/instant-messengers/telegram/tdesktop/default.nix216
-rw-r--r--pkgs/applications/networking/instant-messengers/telegram/tdesktop/tg_owt.nix61
-rwxr-xr-xpkgs/applications/networking/instant-messengers/telegram/tdesktop/update.py73
3 files changed, 0 insertions, 350 deletions
diff --git a/pkgs/applications/networking/instant-messengers/telegram/tdesktop/default.nix b/pkgs/applications/networking/instant-messengers/telegram/tdesktop/default.nix
deleted file mode 100644
index 6b47401c558..00000000000
--- a/pkgs/applications/networking/instant-messengers/telegram/tdesktop/default.nix
+++ /dev/null
@@ -1,216 +0,0 @@
-{ lib
-, fetchFromGitHub
-, fetchpatch
-, fetchurl
-, callPackage
-, pkg-config
-, cmake
-, ninja
-, python3
-, wrapGAppsHook
-, wrapQtAppsHook
-, extra-cmake-modules
-, qtbase
-, qtwayland
-, qtsvg
-, qtimageformats
-, qt5compat
-, gtk3
-, libdbusmenu
-, lz4
-, xxHash
-, ffmpeg
-, openalSoft
-, minizip
-, libopus
-, alsa-lib
-, libpulseaudio
-, pipewire
-, range-v3
-, tl-expected
-, hunspell
-, glibmm_2_68
-, webkitgtk_4_1
-, jemalloc
-, rnnoise
-, protobuf
-, abseil-cpp
-  # Transitive dependencies:
-, util-linuxMinimal
-, pcre
-, libpthreadstubs
-, libXdamage
-, libXdmcp
-, libselinux
-, libsepol
-, libepoxy
-, at-spi2-core
-, libXtst
-, libthai
-, libdatrie
-, xdg-utils
-, xorg
-, libsysprof-capture
-, libpsl
-, brotli
-, microsoft_gsl
-, rlottie
-, stdenv
-}:
-
-# Main reference:
-# - This package was originally based on the Arch package but all patches are now upstreamed:
-#   https://git.archlinux.org/svntogit/community.git/tree/trunk/PKGBUILD?h=packages/telegram-desktop
-# Other references that could be useful:
-# - https://git.alpinelinux.org/aports/tree/testing/telegram-desktop/APKBUILD
-# - https://github.com/void-linux/void-packages/blob/master/srcpkgs/telegram-desktop/template
-
-let
-  tg_owt = callPackage ./tg_owt.nix {
-    abseil-cpp = abseil-cpp.override {
-      cxxStandard = "20";
-    };
-  };
-  glibmm = glibmm_2_68.overrideAttrs (_: {
-    version = "2.76.0";
-    src = fetchurl {
-      url = "mirror://gnome/sources/glibmm/2.76/glibmm-2.76.0.tar.xz";
-      sha256 = "sha256-hjfYDOq9lP3dbkiXCggqJkVY1KuCaE4V/8h+fvNGKrI=";
-    };
-  });
-in
-stdenv.mkDerivation rec {
-  pname = "telegram-desktop";
-  version = "4.7.1";
-  # Note: Update via pkgs/applications/networking/instant-messengers/telegram/tdesktop/update.py
-
-  # Telegram-Desktop with submodules
-  src = fetchFromGitHub {
-    owner = "telegramdesktop";
-    repo = "tdesktop";
-    rev = "v${version}";
-    fetchSubmodules = true;
-    sha256 = "1qv8029xzp2j1j58b1lkw3q53cwaaazvp2la80mfbjv348c29iyk";
-  };
-
-  patches = [
-    # 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=";
-    })
-  ];
-
-  postPatch = ''
-    substituteInPlace Telegram/ThirdParty/libtgvoip/os/linux/AudioInputALSA.cpp \
-      --replace '"libasound.so.2"' '"${alsa-lib}/lib/libasound.so.2"'
-    substituteInPlace Telegram/ThirdParty/libtgvoip/os/linux/AudioOutputALSA.cpp \
-      --replace '"libasound.so.2"' '"${alsa-lib}/lib/libasound.so.2"'
-    substituteInPlace Telegram/ThirdParty/libtgvoip/os/linux/AudioPulse.cpp \
-      --replace '"libpulse.so.0"' '"${libpulseaudio}/lib/libpulse.so.0"'
-    substituteInPlace Telegram/lib_webview/webview/platform/linux/webview_linux_webkit_gtk.cpp \
-      --replace '"libwebkit2gtk-4.1.so.0"' '"${webkitgtk_4_1}/lib/libwebkit2gtk-4.1.so.0"'
-  '';
-
-  # We want to run wrapProgram manually (with additional parameters)
-  dontWrapGApps = true;
-  dontWrapQtApps = true;
-
-  nativeBuildInputs = [
-    pkg-config
-    cmake
-    ninja
-    python3
-    wrapGAppsHook
-    wrapQtAppsHook
-    extra-cmake-modules
-  ];
-
-  buildInputs = [
-    qtbase
-    qtwayland
-    qtsvg
-    qtimageformats
-    qt5compat
-    gtk3
-    libdbusmenu
-    lz4
-    xxHash
-    ffmpeg
-    openalSoft
-    minizip
-    libopus
-    alsa-lib
-    libpulseaudio
-    pipewire
-    range-v3
-    tl-expected
-    hunspell
-    glibmm
-    webkitgtk_4_1
-    jemalloc
-    rnnoise
-    protobuf
-    tg_owt
-    # Transitive dependencies:
-    util-linuxMinimal # Required for libmount thus not nativeBuildInputs.
-    pcre
-    libpthreadstubs
-    libXdamage
-    libXdmcp
-    libselinux
-    libsepol
-    libepoxy
-    at-spi2-core
-    libXtst
-    libthai
-    libdatrie
-    libsysprof-capture
-    libpsl
-    brotli
-    microsoft_gsl
-    rlottie
-  ];
-
-  cmakeFlags = [
-    "-Ddisable_autoupdate=ON"
-    # We're allowed to used the API ID of the Snap package:
-    "-DTDESKTOP_API_ID=611335"
-    "-DTDESKTOP_API_HASH=d524b414d21f4d37f08684c1df41ac9c"
-    # See: https://github.com/NixOS/nixpkgs/pull/130827#issuecomment-885212649
-    "-DDESKTOP_APP_USE_PACKAGED_FONTS=OFF"
-  ];
-
-  postFixup = ''
-    # This is necessary to run Telegram in a pure environment.
-    # We also use gappsWrapperArgs from wrapGAppsHook.
-    wrapProgram $out/bin/telegram-desktop \
-      "''${gappsWrapperArgs[@]}" \
-      "''${qtWrapperArgs[@]}" \
-      --prefix LD_LIBRARY_PATH : "${xorg.libXcursor}/lib" \
-      --suffix PATH : ${lib.makeBinPath [ xdg-utils ]} \
-      --set XDG_RUNTIME_DIR "XDG-RUNTIME-DIR"
-    sed -i $out/bin/telegram-desktop \
-      -e "s,'XDG-RUNTIME-DIR',\"\''${XDG_RUNTIME_DIR:-/run/user/\$(id --user)}\","
-  '';
-
-  passthru = {
-    inherit tg_owt;
-    updateScript = ./update.py;
-  };
-
-  meta = with lib; {
-    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.linux;
-    homepage = "https://desktop.telegram.org/";
-    changelog = "https://github.com/telegramdesktop/tdesktop/releases/tag/v${version}";
-    maintainers = with maintainers; [ nickcao ];
-  };
-}
diff --git a/pkgs/applications/networking/instant-messengers/telegram/tdesktop/tg_owt.nix b/pkgs/applications/networking/instant-messengers/telegram/tdesktop/tg_owt.nix
deleted file mode 100644
index 6e57a81dc29..00000000000
--- a/pkgs/applications/networking/instant-messengers/telegram/tdesktop/tg_owt.nix
+++ /dev/null
@@ -1,61 +0,0 @@
-{ lib, stdenv, fetchFromGitHub, fetchpatch
-, pkg-config, cmake, ninja, yasm
-, libjpeg, openssl_1_1, 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, valgrind, libepoxy, libglvnd
-}:
-
-stdenv.mkDerivation {
-  pname = "tg_owt";
-  version = "unstable-2023-03-14";
-
-  src = fetchFromGitHub {
-    owner = "desktop-app";
-    repo = "tg_owt";
-    rev = "1a18da2ed4d5ce134e984d1586b915738e0da257";
-    sha256 = "18srnl688ng8grfpmgcjpdyr4cw87yjdvyw94b2jjq5jmnq9n3a3";
-    fetchSubmodules = true;
-  };
-
-  outputs = [ "out" "dev" ];
-
-  nativeBuildInputs = [ pkg-config cmake ninja yasm ];
-
-  buildInputs = [
-    libjpeg 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
-  ];
-
-  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=";
-    })
-  ];
-
-  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_1_1
-  ];
-
-  meta = with lib; {
-    license = licenses.bsd3;
-    maintainers = with maintainers; [ oxalica ];
-  };
-}
diff --git a/pkgs/applications/networking/instant-messengers/telegram/tdesktop/update.py b/pkgs/applications/networking/instant-messengers/telegram/tdesktop/update.py
deleted file mode 100755
index 89e40218623..00000000000
--- a/pkgs/applications/networking/instant-messengers/telegram/tdesktop/update.py
+++ /dev/null
@@ -1,73 +0,0 @@
-#! /usr/bin/env nix-shell
-#! nix-shell -i python3 -p python3 nix nix-prefetch-git
-
-import fileinput
-import json
-import os
-import re
-import subprocess
-
-from datetime import datetime
-from urllib.request import urlopen, Request
-
-
-DIR = os.path.dirname(os.path.abspath(__file__))
-HEADERS = {'Accept': 'application/vnd.github.v3+json'}
-
-
-def github_api_request(endpoint):
-    base_url = 'https://api.github.com/'
-    request = Request(base_url + endpoint, headers=HEADERS)
-    with urlopen(request) as http_response:
-        return json.loads(http_response.read().decode('utf-8'))
-
-
-def get_commit_date(repo, sha):
-    url = f'https://api.github.com/repos/{repo}/commits/{sha}'
-    request = Request(url, headers=HEADERS)
-    with urlopen(request) as http_response:
-        commit = json.loads(http_response.read().decode())
-        date = commit['commit']['committer']['date'].rstrip('Z')
-        date = datetime.fromisoformat(date).date().isoformat()
-        return 'unstable-' + date
-
-
-def nix_prefetch_git(url, rev):
-    """Prefetches the requested Git revision (incl. submodules) of the given repository URL."""
-    print(f'nix-prefetch-git {url} {rev}')
-    out = subprocess.check_output(['nix-prefetch-git', '--quiet', '--url', url, '--rev', rev, '--fetch-submodules'])
-    return json.loads(out)['sha256']
-
-
-def nix_prefetch_url(url, unpack=False):
-    """Prefetches the content of the given URL."""
-    print(f'nix-prefetch-url {url}')
-    options = ['--type', 'sha256']
-    if unpack:
-        options += ['--unpack']
-    out = subprocess.check_output(['nix-prefetch-url'] + options + [url])
-    return out.decode('utf-8').rstrip()
-
-
-def update_file(relpath, version, sha256, rev=None):
-    file_path = os.path.join(DIR, relpath)
-    with fileinput.FileInput(file_path, inplace=True) as f:
-        for line in f:
-            result = line
-            result = re.sub(r'^  version = ".+";', f'  version = "{version}";', result)
-            result = re.sub(r'^    sha256 = ".+";', f'    sha256 = "{sha256}";', result)
-            if rev:
-                result = re.sub(r'^    rev = ".*";', f'    rev = "{rev}";', result)
-            print(result, end='')
-
-
-if __name__ == "__main__":
-    tdesktop_tag = github_api_request('repos/telegramdesktop/tdesktop/releases/latest')['tag_name']
-    tdesktop_version = tdesktop_tag.lstrip('v')
-    tdesktop_hash = nix_prefetch_git('https://github.com/telegramdesktop/tdesktop.git', tdesktop_tag)
-    update_file('default.nix', tdesktop_version, tdesktop_hash)
-    tg_owt_ref = github_api_request('repos/desktop-app/tg_owt/commits/master')['sha']
-    tg_owt_version = get_commit_date('desktop-app/tg_owt', tg_owt_ref)
-    tg_owt_hash = nix_prefetch_git('https://github.com/desktop-app/tg_owt.git', tg_owt_ref)
-    update_file('tg_owt.nix', tg_owt_version, tg_owt_hash, tg_owt_ref)
-    tg_owt_ref = github_api_request('repos/desktop-app/tg_owt/commits/master')['sha']