2020-01-10 17:14:10 +00:00
|
|
|
{ mkDerivation, lib, fetchurl, fetchsvn
|
|
|
|
, pkgconfig, cmake, ninja, python3, wrapGAppsHook, wrapQtAppsHook
|
2020-02-11 20:41:25 +00:00
|
|
|
, qtbase, qtimageformats, gtk3, libsForQt5, enchant2, lz4, xxHash
|
2019-10-08 13:34:14 +01:00
|
|
|
, dee, ffmpeg_4, openalSoft, minizip, libopus, alsaLib, libpulseaudio, range-v3
|
2020-02-11 20:41:25 +00:00
|
|
|
, tl-expected, microsoft_gsl
|
2020-01-10 17:14:10 +00:00
|
|
|
# TODO: Shouldn't be required:
|
|
|
|
, pcre, xorg, utillinux, libselinux, libsepol, epoxy, at-spi2-core, libXtst
|
|
|
|
, xdg_utils
|
2019-07-30 15:57:46 +01:00
|
|
|
}:
|
|
|
|
|
|
|
|
with lib;
|
|
|
|
|
2020-01-10 17:14:10 +00:00
|
|
|
# Main reference:
|
2020-01-27 17:49:39 +00:00
|
|
|
# - This package was originally based on the Arch package but all patches are now upstreamed:
|
2020-01-10 17:14:10 +00:00
|
|
|
# https://git.archlinux.org/svntogit/community.git/tree/trunk/PKGBUILD?h=packages/telegram-desktop
|
2020-01-27 17:49:39 +00:00
|
|
|
# Other references that could be useful:
|
2020-01-10 17:14:10 +00:00
|
|
|
# - https://git.alpinelinux.org/aports/tree/testing/telegram-desktop/APKBUILD
|
|
|
|
# - https://github.com/void-linux/void-packages/blob/master/srcpkgs/telegram-desktop/template
|
|
|
|
|
2019-07-30 15:57:46 +01:00
|
|
|
mkDerivation rec {
|
2019-08-10 15:19:55 +01:00
|
|
|
pname = "telegram-desktop";
|
2020-02-20 17:50:39 +00:00
|
|
|
version = "1.9.14";
|
2019-07-30 15:57:46 +01:00
|
|
|
|
|
|
|
# Telegram-Desktop with submodules
|
2020-01-10 17:14:10 +00:00
|
|
|
src = fetchurl {
|
|
|
|
url = "https://github.com/telegramdesktop/tdesktop/releases/download/v${version}/tdesktop-${version}-full.tar.gz";
|
2020-02-20 17:50:39 +00:00
|
|
|
sha256 = "0jsss4b51ylf4qk58frvh2yap1s3cjf3isnlc273cc0fh5g1skc6";
|
2019-07-30 15:57:46 +01:00
|
|
|
};
|
|
|
|
|
|
|
|
postPatch = ''
|
2020-01-23 22:51:05 +00:00
|
|
|
substituteInPlace Telegram/lib_spellcheck/spellcheck/platform/linux/linux_enchant.cpp \
|
|
|
|
--replace '"libenchant-2.so.2"' '"${enchant2}/lib/libenchant-2.so.2"'
|
2020-01-30 18:45:58 +00:00
|
|
|
substituteInPlace Telegram/CMakeLists.txt \
|
|
|
|
--replace '"''${TDESKTOP_LAUNCHER_BASENAME}.appdata.xml"' '"''${TDESKTOP_LAUNCHER_BASENAME}.metainfo.xml"'
|
2019-07-30 15:57:46 +01:00
|
|
|
'';
|
|
|
|
|
|
|
|
# We want to run wrapProgram manually (with additional parameters)
|
|
|
|
dontWrapGApps = true;
|
|
|
|
dontWrapQtApps = true;
|
|
|
|
|
2020-01-10 17:14:10 +00:00
|
|
|
nativeBuildInputs = [ pkgconfig cmake ninja python3 wrapGAppsHook wrapQtAppsHook ];
|
2019-08-10 15:19:55 +01:00
|
|
|
|
2019-07-30 15:57:46 +01:00
|
|
|
buildInputs = [
|
2020-02-11 20:41:25 +00:00
|
|
|
qtbase qtimageformats gtk3 libsForQt5.libdbusmenu enchant2 lz4 xxHash
|
2019-10-08 13:34:14 +01:00
|
|
|
dee ffmpeg_4 openalSoft minizip libopus alsaLib libpulseaudio range-v3
|
2020-02-11 20:41:25 +00:00
|
|
|
tl-expected microsoft_gsl
|
2020-01-10 17:14:10 +00:00
|
|
|
# TODO: Shouldn't be required:
|
|
|
|
pcre xorg.libpthreadstubs xorg.libXdmcp utillinux libselinux libsepol epoxy at-spi2-core libXtst
|
2019-07-30 15:57:46 +01:00
|
|
|
];
|
|
|
|
|
|
|
|
enableParallelBuilding = true;
|
|
|
|
|
2020-01-10 17:14:10 +00:00
|
|
|
cmakeFlags = [
|
2020-01-22 13:29:47 +00:00
|
|
|
"-Ddisable_autoupdate=ON"
|
2020-01-27 17:49:39 +00:00
|
|
|
# TODO: Officiall API credentials for Nixpkgs
|
|
|
|
# (see: https://github.com/NixOS/nixpkgs/issues/55271):
|
|
|
|
"-DTDESKTOP_API_TEST=ON"
|
2020-01-10 17:14:10 +00:00
|
|
|
"-DDESKTOP_APP_USE_GLIBC_WRAPS=OFF"
|
2020-01-22 13:29:47 +00:00
|
|
|
"-DDESKTOP_APP_USE_PACKAGED=ON"
|
|
|
|
"-DDESKTOP_APP_USE_PACKAGED_RLOTTIE=OFF"
|
2020-02-11 20:41:25 +00:00
|
|
|
"-DDESKTOP_APP_USE_PACKAGED_VARIANT=OFF"
|
2020-01-10 17:14:10 +00:00
|
|
|
"-DDESKTOP_APP_DISABLE_CRASH_REPORTS=ON"
|
|
|
|
"-DTDESKTOP_DISABLE_REGISTER_CUSTOM_SCHEME=ON"
|
|
|
|
"-DTDESKTOP_DISABLE_DESKTOP_FILE_GENERATION=ON"
|
2020-01-22 13:29:47 +00:00
|
|
|
"-DTDESKTOP_USE_PACKAGED_TGVOIP=OFF"
|
2020-01-10 17:14:10 +00:00
|
|
|
#"-DDESKTOP_APP_SPECIAL_TARGET=\"\"" # TODO: Error when set to "": Bad special target '""'
|
2020-01-23 22:51:05 +00:00
|
|
|
"-DTDESKTOP_LAUNCHER_BASENAME=telegramdesktop" # Note: This is the default
|
2020-01-10 17:14:10 +00:00
|
|
|
];
|
2019-07-30 15:57:46 +01:00
|
|
|
|
2020-01-22 13:29:47 +00:00
|
|
|
# Note: The following packages could be packaged system-wide, but it's
|
|
|
|
# probably best to use the bundled ones from tdesktop (Arch does this too):
|
|
|
|
# rlottie:
|
|
|
|
# - CMake flag: "-DTDESKTOP_USE_PACKAGED_TGVOIP=ON"
|
|
|
|
# - Sources (problem: there are no stable releases!):
|
|
|
|
# - desktop-app (tdesktop): https://github.com/desktop-app/rlottie
|
|
|
|
# - upstream: https://github.com/Samsung/rlottie
|
|
|
|
# libtgvoip:
|
|
|
|
# - CMake flag: "-DDESKTOP_APP_USE_PACKAGED_RLOTTIE=ON"
|
|
|
|
# - Sources (problem: the stable releases might be too old!):
|
|
|
|
# - tdesktop: https://github.com/telegramdesktop/libtgvoip
|
|
|
|
# - upstream: https://github.com/grishka/libtgvoip
|
|
|
|
# Both of these packages are included in this PR (kotatogram-desktop):
|
|
|
|
# https://github.com/NixOS/nixpkgs/pull/75210
|
2020-02-11 20:41:25 +00:00
|
|
|
# TODO: Package mapbox-variant
|
2020-01-22 13:29:47 +00:00
|
|
|
|
2019-07-30 15:57:46 +01:00
|
|
|
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 PATH : ${xdg_utils}/bin \
|
2020-01-22 13:29:47 +00:00
|
|
|
--set XDG_RUNTIME_DIR "XDG-RUNTIME-DIR" \
|
|
|
|
--unset QT_QPA_PLATFORMTHEME # From the Arch wrapper
|
2019-07-30 15:57:46 +01:00
|
|
|
sed -i $out/bin/telegram-desktop \
|
|
|
|
-e "s,'XDG-RUNTIME-DIR',\"\''${XDG_RUNTIME_DIR:-/run/user/\$(id --user)}\","
|
|
|
|
'';
|
|
|
|
|
|
|
|
meta = {
|
|
|
|
description = "Telegram Desktop messaging app";
|
2019-08-10 15:19:55 +01:00
|
|
|
longDescription = ''
|
|
|
|
Desktop client for the Telegram messenger, based on the Telegram API and
|
|
|
|
the MTProto secure protocol.
|
|
|
|
'';
|
2019-07-30 15:57:46 +01:00
|
|
|
license = licenses.gpl3;
|
|
|
|
platforms = platforms.linux;
|
|
|
|
homepage = https://desktop.telegram.org/;
|
|
|
|
maintainers = with maintainers; [ primeos abbradar ];
|
2016-03-28 14:46:44 +01:00
|
|
|
};
|
|
|
|
}
|