2023-07-15 17:15:38 +00:00
|
|
|
{ lib
|
|
|
|
, buildPythonPackage
|
|
|
|
, fetchFromGitHub
|
2024-04-21 15:54:59 +00:00
|
|
|
, pythonRelaxDepsHook
|
2023-07-15 17:15:38 +00:00
|
|
|
, pytestCheckHook
|
2024-04-21 15:54:59 +00:00
|
|
|
, hatchling
|
2023-07-15 17:15:38 +00:00
|
|
|
, argostranslate
|
|
|
|
, flask
|
|
|
|
, flask-swagger
|
|
|
|
, flask-swagger-ui
|
|
|
|
, flask-limiter
|
|
|
|
, flask-babel
|
|
|
|
, flask-session
|
|
|
|
, waitress
|
|
|
|
, expiringdict
|
2024-04-21 15:54:59 +00:00
|
|
|
, langdetect
|
|
|
|
, lexilang
|
2023-07-15 17:15:38 +00:00
|
|
|
, ltpycld2
|
|
|
|
, morfessor
|
|
|
|
, appdirs
|
|
|
|
, apscheduler
|
|
|
|
, translatehtml
|
|
|
|
, argos-translate-files
|
|
|
|
, requests
|
|
|
|
, redis
|
|
|
|
, prometheus-client
|
|
|
|
, polib
|
|
|
|
, python
|
|
|
|
}:
|
|
|
|
|
|
|
|
buildPythonPackage rec {
|
|
|
|
pname = "libretranslate";
|
2024-05-15 15:35:15 +00:00
|
|
|
version = "1.5.7";
|
2024-04-21 15:54:59 +00:00
|
|
|
pyproject = true;
|
2023-07-15 17:15:38 +00:00
|
|
|
|
|
|
|
src = fetchFromGitHub {
|
|
|
|
owner = "LibreTranslate";
|
|
|
|
repo = "LibreTranslate";
|
|
|
|
rev = "refs/tags/v${version}";
|
2024-05-15 15:35:15 +00:00
|
|
|
hash = "sha256-lOVi/809ig+KtiNwdt9Wovn+2Q8I6amps1sZ5JJy7WE=";
|
2023-07-15 17:15:38 +00:00
|
|
|
};
|
|
|
|
|
2024-04-21 15:54:59 +00:00
|
|
|
build-system = [
|
|
|
|
hatchling
|
|
|
|
pythonRelaxDepsHook
|
|
|
|
];
|
|
|
|
|
|
|
|
pythonRelaxDeps = true;
|
|
|
|
|
|
|
|
dependencies = [
|
2023-07-15 17:15:38 +00:00
|
|
|
argostranslate
|
|
|
|
flask
|
|
|
|
flask-swagger
|
|
|
|
flask-swagger-ui
|
|
|
|
flask-limiter
|
|
|
|
flask-babel
|
|
|
|
flask-session
|
|
|
|
waitress
|
|
|
|
expiringdict
|
2024-04-21 15:54:59 +00:00
|
|
|
langdetect
|
|
|
|
lexilang
|
2023-07-15 17:15:38 +00:00
|
|
|
ltpycld2
|
|
|
|
morfessor
|
|
|
|
appdirs
|
|
|
|
apscheduler
|
|
|
|
translatehtml
|
|
|
|
argos-translate-files
|
|
|
|
requests
|
|
|
|
redis
|
|
|
|
prometheus-client
|
|
|
|
polib
|
|
|
|
];
|
|
|
|
|
|
|
|
postInstall = ''
|
|
|
|
# expose static files to be able to serve them via web-server
|
|
|
|
mkdir -p $out/share/libretranslate
|
|
|
|
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";
|
|
|
|
|
|
|
|
pythonImportsCheck = [ "libretranslate" ];
|
|
|
|
|
|
|
|
meta = with lib; {
|
|
|
|
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/v${version}";
|
|
|
|
license = licenses.agpl3Only;
|
|
|
|
maintainers = with maintainers; [ misuzu ];
|
|
|
|
};
|
|
|
|
}
|