Skip to content

Commit

Permalink
tdesktop: Fix the execution in a pure environment
Browse files Browse the repository at this point in the history
Telegram was crashing when executed within a pure environment
(nix-shell -p tdesktop --pure).
Setting the environment variables QT_PLUGIN_PATH and XDG_RUNTIME_DIR
should resolve this issue. Fix #33729.
  • Loading branch information
primeos committed Jan 22, 2018
1 parent 9593ead commit a03b2b9
Showing 1 changed file with 9 additions and 2 deletions.
@@ -1,5 +1,5 @@
{ mkDerivation, lib, fetchgit, fetchpatch
, pkgconfig, gyp, cmake, gcc7
, pkgconfig, gyp, cmake, gcc7, makeWrapper
, qtbase, qtimageformats, gtk3, libappindicator-gtk3
, dee, ffmpeg, openalSoft, minizip, libopus, alsaLib, libpulseaudio, range-v3
}:
Expand Down Expand Up @@ -31,7 +31,7 @@ mkDerivation rec {
})
];

nativeBuildInputs = [ pkgconfig gyp cmake gcc7 ];
nativeBuildInputs = [ pkgconfig gyp cmake gcc7 makeWrapper ];

buildInputs = [
qtbase qtimageformats gtk3 libappindicator-gtk3
Expand Down Expand Up @@ -107,6 +107,13 @@ mkDerivation rec {
for icon_size in 16 32 48 64 128 256 512; do
install -Dm644 "../../../Telegram/Resources/art/icon''${icon_size}.png" "$out/share/icons/hicolor/''${icon_size}x''${icon_size}/apps/telegram-desktop.png"
done
# This is necessary to run Telegram in a pure environment.
wrapProgram $out/bin/telegram-desktop \
--prefix QT_PLUGIN_PATH : "${qtbase}/${qtbase.qtPluginPrefix}" \
--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)}\","
'';

meta = with lib; {
Expand Down

0 comments on commit a03b2b9

Please sign in to comment.