about summary refs log tree commit diff
diff options
context:
space:
mode:
authorNikolay Korotkiy <sikmir@disroot.org>2024-03-09 23:15:40 +0400
committerGitHub <noreply@github.com>2024-03-09 23:15:40 +0400
commit2340120c6ffeed371bcf8121a57bec80d3adbd6e (patch)
tree0766ab66febc016dd9aa41a1d996b1a3fae34332
parent8b7eef367c1bdebc8b37be47fcb7b4e9a1ed6e1e (diff)
parent210e0193bf7b01d166722f6f7646d57e2b39d257 (diff)
downloadnixlib-2340120c6ffeed371bcf8121a57bec80d3adbd6e.tar
nixlib-2340120c6ffeed371bcf8121a57bec80d3adbd6e.tar.gz
nixlib-2340120c6ffeed371bcf8121a57bec80d3adbd6e.tar.bz2
nixlib-2340120c6ffeed371bcf8121a57bec80d3adbd6e.tar.lz
nixlib-2340120c6ffeed371bcf8121a57bec80d3adbd6e.tar.xz
nixlib-2340120c6ffeed371bcf8121a57bec80d3adbd6e.tar.zst
nixlib-2340120c6ffeed371bcf8121a57bec80d3adbd6e.zip
Merge pull request #293815 from Aleksanaa/tg
tg: fix sending message and desktop notification
-rw-r--r--pkgs/applications/networking/instant-messengers/telegram/tg/default.nix24
1 files changed, 23 insertions, 1 deletions
diff --git a/pkgs/applications/networking/instant-messengers/telegram/tg/default.nix b/pkgs/applications/networking/instant-messengers/telegram/tg/default.nix
index 0918bfee91e2..f0c054fd7a90 100644
--- a/pkgs/applications/networking/instant-messengers/telegram/tg/default.nix
+++ b/pkgs/applications/networking/instant-messengers/telegram/tg/default.nix
@@ -1,4 +1,12 @@
-{ lib, buildPythonApplication, fetchFromGitHub, pythonOlder, python-telegram }:
+{ lib
+, buildPythonApplication
+, fetchFromGitHub
+, pythonOlder
+, fetchpatch
+, stdenv
+, libnotify
+, python-telegram
+}:
 
 buildPythonApplication rec {
   pname = "tg";
@@ -12,6 +20,20 @@ buildPythonApplication rec {
     hash = "sha256-apHd26XnOz5nak+Kz8PJPsonQfTWDyPz7Mi/tWf7zwM=";
   };
 
+  patches = [
+    # Fix sending messages
+    # https://github.com/paul-nameless/tg/pull/306
+    (fetchpatch {
+      url = "https://github.com/mindtheegab/tg/commit/13e2b266989d2d757a394b0fb8cb7fd6ccc2b70c.patch";
+      hash = "sha256-Wja6xBOlPuACzhbT8Yl3F8qSh3Kd9G1lnr9VarbPrfM=";
+    })
+  ];
+
+  # Fix notifications on platforms other than darwin by providing notify-send
+  postPatch = lib.optionalString (!stdenv.isDarwin) ''
+    sed -i 's|^NOTIFY_CMD = .*|NOTIFY_CMD = "${libnotify}/bin/notify-send {title} {message} -i {icon_path}"|' tg/config.py
+  '';
+
   propagatedBuildInputs = [ python-telegram ];
 
   doCheck = false; # No tests