nixos-config/machines/hiroshi/services/languagetool.nix

38 lines
1.1 KiB
Nix
Raw Normal View History

# SPDX-FileCopyrightText: 2023-2024 Simon Bruder <simon@sbruder.de>
#
# 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 = {
# http://languagetool.org/download/ngram-data/
2023-03-01 15:12:17 +01:00
languageModel = "/var/lib/languagetool/ngrams";
# 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";
# 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" = {
enableACME = true;
forceSSL = true;
2023-03-01 15:12:17 +01:00
locations = {
"/".proxyPass = "http://127.0.0.1:${toString cfg.port}";
};
};
}