2024-08-20 22:57:55 +02:00
|
|
|
# SPDX-FileCopyrightText: 2023-2024 Simon Bruder <simon@sbruder.de>
|
2024-01-06 01:19:35 +01:00
|
|
|
#
|
|
|
|
# SPDX-License-Identifier: AGPL-3.0-or-later
|
|
|
|
|
2023-03-01 15:12:17 +01:00
|
|
|
{ config, pkgs, ... }:
|
|
|
|
let
|
|
|
|
cfg = config.services.languagetool;
|
|
|
|
in
|
|
|
|
{
|
|
|
|
services.languagetool = {
|
|
|
|
enable = true;
|
|
|
|
#allowOrigin = "https://languagetool.sbruder.de";
|
|
|
|
allowOrigin = "*";
|
|
|
|
settings = {
|
2024-08-20 22:57:55 +02:00
|
|
|
# http://languagetool.org/download/ngram-data/
|
2023-03-01 15:12:17 +01:00
|
|
|
languageModel = "/var/lib/languagetool/ngrams";
|
2024-08-20 22:57:55 +02:00
|
|
|
# https://fasttext.cc/docs/en/language-identification.html
|
2023-03-01 15:12:17 +01:00
|
|
|
fasttextModel = "/var/lib/languagetool/fasttext/lid.176.bin";
|
|
|
|
fasttextBinary = "${pkgs.fasttext}/bin/fasttext";
|
|
|
|
};
|
|
|
|
};
|
|
|
|
|
|
|
|
# default log level is INFO, no easy way to reduce it.
|
|
|
|
#systemd.services.languagetool.serviceConfig.StandardOutput = "null";
|
|
|
|
|
2024-08-24 11:17:33 +02:00
|
|
|
# It often runs out of java heap memory, no matter what settinsg are used.
|
|
|
|
systemd.services.languagetool.serviceConfig.Restart = "always";
|
|
|
|
|
2023-03-01 15:12:17 +01:00
|
|
|
services.nginx.virtualHosts."languagetool.sbruder.de" = {
|
2024-08-20 22:57:55 +02:00
|
|
|
enableACME = true;
|
|
|
|
forceSSL = true;
|
|
|
|
|
2023-03-01 15:12:17 +01:00
|
|
|
locations = {
|
|
|
|
"/".proxyPass = "http://127.0.0.1:${toString cfg.port}";
|
|
|
|
};
|
|
|
|
};
|
|
|
|
}
|