e7ec2969af
GitOrigin-RevId: 9b19f5e77dd906cb52dade0b7bd280339d2a1f3d
94 lines
1.9 KiB
Nix
94 lines
1.9 KiB
Nix
{ lib
|
|
, buildPythonPackage
|
|
, fetchFromGitHub
|
|
, pytestCheckHook
|
|
, argostranslate
|
|
, flask
|
|
, flask-swagger
|
|
, flask-swagger-ui
|
|
, flask-limiter
|
|
, flask-babel
|
|
, flask-session
|
|
, waitress
|
|
, expiringdict
|
|
, ltpycld2
|
|
, morfessor
|
|
, appdirs
|
|
, apscheduler
|
|
, translatehtml
|
|
, argos-translate-files
|
|
, requests
|
|
, redis
|
|
, prometheus-client
|
|
, polib
|
|
, python
|
|
}:
|
|
|
|
buildPythonPackage rec {
|
|
pname = "libretranslate";
|
|
version = "1.5.2";
|
|
|
|
format = "setuptools";
|
|
|
|
src = fetchFromGitHub {
|
|
owner = "LibreTranslate";
|
|
repo = "LibreTranslate";
|
|
rev = "refs/tags/v${version}";
|
|
hash = "sha256-8bbVpC53wH9GvwwHHlPEYQd/zqMXIqrwixwn4HY6FMg=";
|
|
};
|
|
|
|
propagatedBuildInputs = [
|
|
argostranslate
|
|
flask
|
|
flask-swagger
|
|
flask-swagger-ui
|
|
flask-limiter
|
|
flask-babel
|
|
flask-session
|
|
waitress
|
|
expiringdict
|
|
ltpycld2
|
|
morfessor
|
|
appdirs
|
|
apscheduler
|
|
translatehtml
|
|
argos-translate-files
|
|
requests
|
|
redis
|
|
prometheus-client
|
|
polib
|
|
];
|
|
|
|
postPatch = ''
|
|
substituteInPlace requirements.txt \
|
|
--replace "==" ">="
|
|
|
|
substituteInPlace setup.py \
|
|
--replace "'pytest-runner'" ""
|
|
'';
|
|
|
|
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 ];
|
|
};
|
|
}
|