From 0bafac1fe58cc339bae017caabb84bc2fdcfe4ba Mon Sep 17 00:00:00 2001 From: Steven Allen Date: Wed, 18 Mar 2026 09:38:03 -0700 Subject: [PATCH 1/4] python3Packages.argos-translate-files: modernize - Fetch from GitHub - And avoid recursive attribute sets. - Enable checks --- .../argos-translate-files/default.nix | 22 ++++++++++--------- 1 file changed, 12 insertions(+), 10 deletions(-) diff --git a/pkgs/development/python-modules/argos-translate-files/default.nix b/pkgs/development/python-modules/argos-translate-files/default.nix index 1e3b2e7661d7..9776dde15d7b 100644 --- a/pkgs/development/python-modules/argos-translate-files/default.nix +++ b/pkgs/development/python-modules/argos-translate-files/default.nix @@ -1,7 +1,8 @@ { lib, buildPythonPackage, - fetchPypi, + fetchFromGitHub, + pytestCheckHook, writableTmpDirAsHomeHook, setuptools, lxml, @@ -10,14 +11,16 @@ translatehtml, }: -buildPythonPackage rec { +buildPythonPackage (finalAttrs: { pname = "argos-translate-files"; version = "1.4.1"; pyproject = true; - src = fetchPypi { - inherit pname version; - hash = "sha256-9ufNuExfyW3gr8+pIpp6Ie03e0hE4l3l3kk6EiVH0x8="; + src = fetchFromGitHub { + owner = "LibreTranslate"; + repo = "argos-translate-files"; + tag = "v${finalAttrs.version}"; + hash = "sha256-XCrABdyly249dpam0pSwTWHoli/uijoUYKaHQhCqB7Y="; }; build-system = [ setuptools ]; @@ -29,15 +32,14 @@ buildPythonPackage rec { translatehtml ]; + doCheck = true; + nativeCheckInputs = [ + pytestCheckHook # pythonImportsCheck needs a home dir for argostranslatefiles writableTmpDirAsHomeHook ]; - postPatch = '' - ln -s */requires.txt requirements.txt - ''; - pythonImportsCheck = [ "argostranslatefiles" ]; meta = { @@ -46,4 +48,4 @@ buildPythonPackage rec { license = lib.licenses.mit; maintainers = with lib.maintainers; [ misuzu ]; }; -} +}) From 140e029bf517374547cda15efaeef2a051726ba1 Mon Sep 17 00:00:00 2001 From: Steven Allen Date: Wed, 18 Mar 2026 09:47:29 -0700 Subject: [PATCH 2/4] python3Packages.argos-translate-files: 1.4.1 -> 1.4.4 This keeps the upstream argostranslate dependency instead of the argos-translate-lt fork. --- .../argos-translate-files/default.nix | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/pkgs/development/python-modules/argos-translate-files/default.nix b/pkgs/development/python-modules/argos-translate-files/default.nix index 9776dde15d7b..dc86edc06605 100644 --- a/pkgs/development/python-modules/argos-translate-files/default.nix +++ b/pkgs/development/python-modules/argos-translate-files/default.nix @@ -13,18 +13,29 @@ buildPythonPackage (finalAttrs: { pname = "argos-translate-files"; - version = "1.4.1"; + version = "1.4.4"; pyproject = true; src = fetchFromGitHub { owner = "LibreTranslate"; repo = "argos-translate-files"; tag = "v${finalAttrs.version}"; - hash = "sha256-XCrABdyly249dpam0pSwTWHoli/uijoUYKaHQhCqB7Y="; + hash = "sha256-6AxVBiK0g6ajstyCQZ9ExF9MRYSLd4Frw03N7c9bvuI="; }; build-system = [ setuptools ]; + pythonRelaxDeps = [ "beautifulsoup4" ]; + + # LibreTranslate has forked argos-translate [1] to fix some bugs and + # make stanza optional, but it's unclear what the future of this fork + # is. + # + # We'll stay on upstream argostranslate for now. + # + # [1]: https://github.com/Libretranslate/argos-translate/ + pythonRemoveDeps = [ "argos-translate-lt" ]; + dependencies = [ lxml pymupdf From a16e7472d5b04a26f0358a8f28ddfc45d59817d7 Mon Sep 17 00:00:00 2001 From: Steven Allen Date: Wed, 18 Mar 2026 09:01:37 -0700 Subject: [PATCH 3/4] libretranslate: modernize - Avoid recursive attribute set. - Use writeableTmpDirAsHomeHook --- .../python-modules/libretranslate/default.nix | 19 +++++++------------ 1 file changed, 7 insertions(+), 12 deletions(-) diff --git a/pkgs/development/python-modules/libretranslate/default.nix b/pkgs/development/python-modules/libretranslate/default.nix index 296b45f6dc20..c9495a15f214 100644 --- a/pkgs/development/python-modules/libretranslate/default.nix +++ b/pkgs/development/python-modules/libretranslate/default.nix @@ -3,7 +3,7 @@ pkgs, buildPythonPackage, fetchFromGitHub, - pytestCheckHook, + writableTmpDirAsHomeHook, runCommand, hatchling, argostranslate, @@ -32,7 +32,7 @@ lndir, }: -buildPythonPackage rec { +buildPythonPackage (finalAttrs: { pname = "libretranslate"; version = "1.9.0"; pyproject = true; @@ -40,8 +40,8 @@ buildPythonPackage rec { src = fetchFromGitHub { owner = "LibreTranslate"; repo = "LibreTranslate"; - tag = "v${version}"; hash = "sha256-bBs7gG42H4MNca5RUiedKNQkLjKpBm2SbPMRyh2gh6c="; + tag = "v${finalAttrs.version}"; }; build-system = [ @@ -80,13 +80,8 @@ buildPythonPackage rec { ln -s $out/${python.sitePackages}/libretranslate/static $out/share/libretranslate/static ''; - doCheck = false; # needs network access - - nativeCheckInputs = [ pytestCheckHook ]; - - # required for import check to work (argostranslate) - env.HOME = "/tmp"; - + # needed to import the argostranslate module + nativeCheckInputs = [ writableTmpDirAsHomeHook ]; pythonImportsCheck = [ "libretranslate" ]; passthru = { @@ -112,8 +107,8 @@ buildPythonPackage rec { meta = { description = "Free and Open Source Machine Translation API. Self-hosted, no limits, no ties to proprietary services"; homepage = "https://libretranslate.com"; - changelog = "https://github.com/LibreTranslate/LibreTranslate/releases/tag/${src.tag}"; + changelog = "https://github.com/LibreTranslate/LibreTranslate/releases/tag/${finalAttrs.src.tag}"; license = lib.licenses.agpl3Only; maintainers = with lib.maintainers; [ misuzu ]; }; -} +}) From c99ea9bb2d3d363308c3e337ca780894c1c62150 Mon Sep 17 00:00:00 2001 From: Steven Allen Date: Wed, 18 Mar 2026 09:35:53 -0700 Subject: [PATCH 4/4] libretranslate: 1.9.0 -> 1.9.5 This keeps the upstream argostranslate dependency instead of the argos-translate-lt fork. --- .../python-modules/libretranslate/default.nix | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/pkgs/development/python-modules/libretranslate/default.nix b/pkgs/development/python-modules/libretranslate/default.nix index c9495a15f214..1b3cc31e3cf4 100644 --- a/pkgs/development/python-modules/libretranslate/default.nix +++ b/pkgs/development/python-modules/libretranslate/default.nix @@ -34,14 +34,14 @@ buildPythonPackage (finalAttrs: { pname = "libretranslate"; - version = "1.9.0"; + version = "1.9.5"; pyproject = true; src = fetchFromGitHub { owner = "LibreTranslate"; repo = "LibreTranslate"; - hash = "sha256-bBs7gG42H4MNca5RUiedKNQkLjKpBm2SbPMRyh2gh6c="; tag = "v${finalAttrs.version}"; + hash = "sha256-VcMo1GX+ituQOW8Dpt0ABJG5fsJbFuxAPmi59Byg5ww="; }; build-system = [ @@ -50,6 +50,14 @@ buildPythonPackage (finalAttrs: { pythonRelaxDeps = true; + # LibreTranslate has forked argos-translate [1] to fix some bugs and make stanza optional, but it's + # unclear what the future of this fork is. + # + # We'll stay on upstream argostranslate for now. + # + # [1]: https://github.com/Libretranslate/argos-translate/ + pythonRemoveDeps = [ "argos-translate-lt" ]; + dependencies = [ argostranslate flask