From 3ab7c2bfd980c099e73350b94339bad002ee5c66 Mon Sep 17 00:00:00 2001 From: Fabian Affolter Date: Fri, 5 Apr 2024 10:10:38 +0200 Subject: [PATCH 1/2] twtxt: refactor - add pythonImportsCheck - remove postPatch section - set build-system - add changelog to meta --- .../applications/networking/twtxt/default.nix | 37 +++++++++++++------ 1 file changed, 25 insertions(+), 12 deletions(-) diff --git a/pkgs/applications/networking/twtxt/default.nix b/pkgs/applications/networking/twtxt/default.nix index eb216b1df861..c5c066d23fa5 100644 --- a/pkgs/applications/networking/twtxt/default.nix +++ b/pkgs/applications/networking/twtxt/default.nix @@ -1,27 +1,39 @@ -{ lib, fetchFromGitHub, buildPythonApplication, aiohttp, python-dateutil, humanize, click, pytestCheckHook, tox }: +{ lib +, fetchFromGitHub +, python3 +}: -buildPythonApplication rec { +python3.pkgs.buildPythonApplication rec { pname = "twtxt"; version = "1.3.1"; + pyproject = true; src = fetchFromGitHub { owner = "buckket"; - repo = pname; + repo = "twtxt"; rev = "refs/tags/v${version}"; sha256 = "sha256-CbFh1o2Ijinfb8X+h1GP3Tp+8D0D3/Czt/Uatd1B4cw="; }; - # Relax some dependencies - postPatch = '' - substituteInPlace setup.py \ - --replace 'aiohttp>=2.2.5,<3' 'aiohttp' \ - --replace 'click>=6.7,<7' 'click' \ - --replace 'humanize>=0.5.1,<1' 'humanize' - ''; + build-system = with python3.pkgs; [ + setuptools + ]; - propagatedBuildInputs = [ aiohttp python-dateutil humanize click ]; + dependencies = with python3.pkgs; [ + aiohttp + click + humanize + python-dateutil + setuptools + ]; - nativeCheckInputs = [ pytestCheckHook tox ]; + nativeCheckInputs = with python3.pkgs; [ + pytestCheckHook + ]; + + pythonImportsCheck = [ + "twtxt" + ]; disabledTests = [ # Disable test using relative date and time @@ -31,6 +43,7 @@ buildPythonApplication rec { meta = with lib; { description = "Decentralised, minimalist microblogging service for hackers"; homepage = "https://github.com/buckket/twtxt"; + changelog = "https://github.com/buckket/twtxt/releases/tag/v${version}"; license = licenses.mit; maintainers = with maintainers; [ siraben ]; mainProgram = "twtxt"; From 26bf0f9d53830813a85848a527dc4d91cfacadb6 Mon Sep 17 00:00:00 2001 From: Fabian Affolter Date: Fri, 5 Apr 2024 10:12:17 +0200 Subject: [PATCH 2/2] twtxt: format with nixfmt --- .../applications/networking/twtxt/default.nix | 23 ++++++++----------- 1 file changed, 9 insertions(+), 14 deletions(-) diff --git a/pkgs/applications/networking/twtxt/default.nix b/pkgs/applications/networking/twtxt/default.nix index c5c066d23fa5..bee27ef2a743 100644 --- a/pkgs/applications/networking/twtxt/default.nix +++ b/pkgs/applications/networking/twtxt/default.nix @@ -1,6 +1,7 @@ -{ lib -, fetchFromGitHub -, python3 +{ + lib, + fetchFromGitHub, + python3, }: python3.pkgs.buildPythonApplication rec { @@ -15,9 +16,7 @@ python3.pkgs.buildPythonApplication rec { sha256 = "sha256-CbFh1o2Ijinfb8X+h1GP3Tp+8D0D3/Czt/Uatd1B4cw="; }; - build-system = with python3.pkgs; [ - setuptools - ]; + build-system = with python3.pkgs; [ setuptools ]; dependencies = with python3.pkgs; [ aiohttp @@ -27,17 +26,13 @@ python3.pkgs.buildPythonApplication rec { setuptools ]; - nativeCheckInputs = with python3.pkgs; [ - pytestCheckHook - ]; + nativeCheckInputs = with python3.pkgs; [ pytestCheckHook ]; - pythonImportsCheck = [ - "twtxt" - ]; + pythonImportsCheck = [ "twtxt" ]; disabledTests = [ - # Disable test using relative date and time - "test_tweet_relative_datetime" + # Disable test using relative date and time + "test_tweet_relative_datetime" ]; meta = with lib; {