From 3b519806b989c632099443533eec2c47c1952f6a Mon Sep 17 00:00:00 2001 From: Nikolay Korotkiy Date: Fri, 25 Jul 2025 22:08:30 +0400 Subject: [PATCH 1/2] =?UTF-8?q?tg:=200.19.0=20=E2=86=92=200.22.0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../telegram/tg/default.nix | 45 ++++++++++--------- 1 file changed, 23 insertions(+), 22 deletions(-) diff --git a/pkgs/applications/networking/instant-messengers/telegram/tg/default.nix b/pkgs/applications/networking/instant-messengers/telegram/tg/default.nix index 26f850e0726b..a12db6326f4e 100644 --- a/pkgs/applications/networking/instant-messengers/telegram/tg/default.nix +++ b/pkgs/applications/networking/instant-messengers/telegram/tg/default.nix @@ -2,49 +2,50 @@ lib, buildPythonApplication, fetchFromGitHub, + poetry-core, pythonOlder, - fetchpatch, stdenv, libnotify, + mailcap-fix, python-telegram, }: buildPythonApplication rec { pname = "tg"; - version = "0.19.0"; - format = "setuptools"; - disabled = pythonOlder "3.8"; + version = "0.22.0"; + pyproject = true; + disabled = pythonOlder "3.9"; src = fetchFromGitHub { owner = "paul-nameless"; - repo = pname; - rev = "v${version}"; - hash = "sha256-apHd26XnOz5nak+Kz8PJPsonQfTWDyPz7Mi/tWf7zwM="; + repo = "tg"; + tag = "v${version}"; + hash = "sha256-qzqYkksocR86QFmP75ZE93kMSVmdel+OTxPgt9uZHLI="; }; - 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) '' + 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 ''; - propagatedBuildInputs = [ python-telegram ]; + build-system = [ poetry-core ]; + + dependencies = [ + mailcap-fix + python-telegram + ]; doCheck = false; # No tests - meta = with lib; { + meta = { description = "Terminal client for telegram"; mainProgram = "tg"; homepage = "https://github.com/paul-nameless/tg"; - license = licenses.unlicense; - maintainers = with maintainers; [ sikmir ]; + license = lib.licenses.unlicense; + maintainers = with lib.maintainers; [ sikmir ]; }; } From 5601b10229abb8717e656600778e48c0600bf6be Mon Sep 17 00:00:00 2001 From: Nikolay Korotkiy Date: Fri, 25 Jul 2025 22:11:50 +0400 Subject: [PATCH 2/2] tg: migrate to by-name --- .../tg/default.nix => by-name/tg/tg/package.nix} | 14 +++++--------- pkgs/top-level/all-packages.nix | 2 -- 2 files changed, 5 insertions(+), 11 deletions(-) rename pkgs/{applications/networking/instant-messengers/telegram/tg/default.nix => by-name/tg/tg/package.nix} (82%) diff --git a/pkgs/applications/networking/instant-messengers/telegram/tg/default.nix b/pkgs/by-name/tg/tg/package.nix similarity index 82% rename from pkgs/applications/networking/instant-messengers/telegram/tg/default.nix rename to pkgs/by-name/tg/tg/package.nix index a12db6326f4e..ad714cd23cd1 100644 --- a/pkgs/applications/networking/instant-messengers/telegram/tg/default.nix +++ b/pkgs/by-name/tg/tg/package.nix @@ -1,20 +1,16 @@ { lib, - buildPythonApplication, fetchFromGitHub, - poetry-core, - pythonOlder, + python3Packages, stdenv, libnotify, - mailcap-fix, - python-telegram, }: -buildPythonApplication rec { +python3Packages.buildPythonApplication rec { pname = "tg"; version = "0.22.0"; pyproject = true; - disabled = pythonOlder "3.9"; + disabled = python3Packages.pythonOlder "3.9"; src = fetchFromGitHub { owner = "paul-nameless"; @@ -32,9 +28,9 @@ buildPythonApplication rec { sed -i 's|^NOTIFY_CMD = .*|NOTIFY_CMD = "${libnotify}/bin/notify-send {title} {message} -i {icon_path}"|' tg/config.py ''; - build-system = [ poetry-core ]; + build-system = [ python3Packages.poetry-core ]; - dependencies = [ + dependencies = with python3Packages; [ mailcap-fix python-telegram ]; diff --git a/pkgs/top-level/all-packages.nix b/pkgs/top-level/all-packages.nix index 0f3f58c27b75..b0fa514a1450 100644 --- a/pkgs/top-level/all-packages.nix +++ b/pkgs/top-level/all-packages.nix @@ -13861,8 +13861,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;