2024-06-05 15:53:02 +00:00
|
|
|
{
|
|
|
|
lib,
|
|
|
|
buildPythonPackage,
|
|
|
|
fetchFromGitHub,
|
|
|
|
pythonRelaxDepsHook,
|
|
|
|
pytestCheckHook,
|
|
|
|
hatchling,
|
|
|
|
argostranslate,
|
|
|
|
flask,
|
|
|
|
flask-swagger,
|
|
|
|
flask-swagger-ui,
|
|
|
|
flask-limiter,
|
|
|
|
flask-babel,
|
|
|
|
flask-session,
|
|
|
|
waitress,
|
|
|
|
expiringdict,
|
|
|
|
langdetect,
|
|
|
|
lexilang,
|
|
|
|
ltpycld2,
|
|
|
|
morfessor,
|
|
|
|
appdirs,
|
|
|
|
apscheduler,
|
|
|
|
translatehtml,
|
|
|
|
argos-translate-files,
|
|
|
|
requests,
|
|
|
|
redis,
|
|
|
|
prometheus-client,
|
|
|
|
polib,
|
|
|
|
python,
|
2023-07-15 17:15:38 +00:00
|
|
|
}:
|
|
|
|
|
|
|
|
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
|
|
|
|
|
2024-06-05 15:53:02 +00:00
|
|
|
nativeCheckInputs = [ pytestCheckHook ];
|
2023-07-15 17:15:38 +00:00
|
|
|
|
|
|
|
# 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 ];
|
|
|
|
};
|
|
|
|
}
|