Unverified Commit 2340120c authored by Nikolay Korotkiy's avatar Nikolay Korotkiy Committed by GitHub
Browse files

Merge pull request #293815 from Aleksanaa/tg

tg: fix sending message and desktop notification
parents 8b7eef36 210e0193
Loading
Loading
Loading
Loading
+23 −1
Original line number Diff line number Diff line
{ 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