diff --git a/pkgs/applications/networking/instant-messengers/telegram/tg/default.nix b/pkgs/applications/networking/instant-messengers/telegram/tg/default.nix deleted file mode 100644 index 26f850e0726b..000000000000 --- a/pkgs/applications/networking/instant-messengers/telegram/tg/default.nix +++ /dev/null @@ -1,50 +0,0 @@ -{ - lib, - buildPythonApplication, - fetchFromGitHub, - pythonOlder, - fetchpatch, - stdenv, - libnotify, - python-telegram, -}: - -buildPythonApplication rec { - pname = "tg"; - version = "0.19.0"; - format = "setuptools"; - disabled = pythonOlder "3.8"; - - src = fetchFromGitHub { - owner = "paul-nameless"; - repo = pname; - rev = "v${version}"; - 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.hostPlatform.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 - - meta = with lib; { - description = "Terminal client for telegram"; - mainProgram = "tg"; - homepage = "https://github.com/paul-nameless/tg"; - license = licenses.unlicense; - maintainers = with maintainers; [ sikmir ]; - }; -} diff --git a/pkgs/by-name/tg/tg/package.nix b/pkgs/by-name/tg/tg/package.nix new file mode 100644 index 000000000000..ad714cd23cd1 --- /dev/null +++ b/pkgs/by-name/tg/tg/package.nix @@ -0,0 +1,47 @@ +{ + lib, + fetchFromGitHub, + python3Packages, + stdenv, + libnotify, +}: + +python3Packages.buildPythonApplication rec { + pname = "tg"; + version = "0.22.0"; + pyproject = true; + disabled = python3Packages.pythonOlder "3.9"; + + src = fetchFromGitHub { + owner = "paul-nameless"; + repo = "tg"; + tag = "v${version}"; + hash = "sha256-qzqYkksocR86QFmP75ZE93kMSVmdel+OTxPgt9uZHLI="; + }; + + postPatch = '' + substituteInPlace pyproject.toml \ + --replace-fail "poetry-core>=1.0.0,<2.0.0" "poetry-core" + '' + + lib.optionalString (!stdenv.hostPlatform.isDarwin) '' + # Fix notifications on platforms other than darwin by providing notify-send + sed -i 's|^NOTIFY_CMD = .*|NOTIFY_CMD = "${libnotify}/bin/notify-send {title} {message} -i {icon_path}"|' tg/config.py + ''; + + build-system = [ python3Packages.poetry-core ]; + + dependencies = with python3Packages; [ + mailcap-fix + python-telegram + ]; + + doCheck = false; # No tests + + meta = { + description = "Terminal client for telegram"; + mainProgram = "tg"; + homepage = "https://github.com/paul-nameless/tg"; + license = lib.licenses.unlicense; + maintainers = with lib.maintainers; [ sikmir ]; + }; +} diff --git a/pkgs/top-level/all-packages.nix b/pkgs/top-level/all-packages.nix index affa0ae81764..03782cbb11c6 100644 --- a/pkgs/top-level/all-packages.nix +++ b/pkgs/top-level/all-packages.nix @@ -13838,8 +13838,6 @@ with pkgs; stdenv = if stdenv.hostPlatform.isDarwin then llvmPackages_19.stdenv else stdenv; }; - tg = python3Packages.callPackage ../applications/networking/instant-messengers/telegram/tg { }; - termdown = python3Packages.callPackage ../applications/misc/termdown { }; terminaltexteffects = with python3Packages; toPythonApplication terminaltexteffects;