forked from mirrors/nixpkgs
nixos/service/languagetool: init
This commit is contained in:
parent
510ba0c791
commit
8be4e9e2ec
|
@ -206,6 +206,13 @@
|
||||||
<link xlink:href="options.html#opt-services.kanata.enable">services.kanata</link>.
|
<link xlink:href="options.html#opt-services.kanata.enable">services.kanata</link>.
|
||||||
</para>
|
</para>
|
||||||
</listitem>
|
</listitem>
|
||||||
|
<listitem>
|
||||||
|
<para>
|
||||||
|
<link xlink:href="https://languagetool.org/">languagetool</link>,
|
||||||
|
a multilingual grammar, style, and spell checker. Available as
|
||||||
|
<link xlink:href="options.html#opt-services.languagetool.enable">services.languagetool</link>.
|
||||||
|
</para>
|
||||||
|
</listitem>
|
||||||
<listitem>
|
<listitem>
|
||||||
<para>
|
<para>
|
||||||
<link xlink:href="https://www.getoutline.com/">Outline</link>,
|
<link xlink:href="https://www.getoutline.com/">Outline</link>,
|
||||||
|
|
|
@ -76,6 +76,9 @@ In addition to numerous new and upgraded packages, this release has the followin
|
||||||
- [kanata](https://github.com/jtroo/kanata), a tool to improve keyboard comfort and usability with advanced customization.
|
- [kanata](https://github.com/jtroo/kanata), a tool to improve keyboard comfort and usability with advanced customization.
|
||||||
Available as [services.kanata](options.html#opt-services.kanata.enable).
|
Available as [services.kanata](options.html#opt-services.kanata.enable).
|
||||||
|
|
||||||
|
- [languagetool](https://languagetool.org/), a multilingual grammar, style, and spell checker.
|
||||||
|
Available as [services.languagetool](options.html#opt-services.languagetool.enable).
|
||||||
|
|
||||||
- [Outline](https://www.getoutline.com/), a wiki and knowledge base similar to Notion. Available as [services.outline](#opt-services.outline.enable).
|
- [Outline](https://www.getoutline.com/), a wiki and knowledge base similar to Notion. Available as [services.outline](#opt-services.outline.enable).
|
||||||
|
|
||||||
- [netbird](https://netbird.io), a zero configuration VPN.
|
- [netbird](https://netbird.io), a zero configuration VPN.
|
||||||
|
|
|
@ -589,6 +589,7 @@
|
||||||
./services/misc/jackett.nix
|
./services/misc/jackett.nix
|
||||||
./services/misc/jellyfin.nix
|
./services/misc/jellyfin.nix
|
||||||
./services/misc/klipper.nix
|
./services/misc/klipper.nix
|
||||||
|
./services/misc/languagetool.nix
|
||||||
./services/misc/logkeys.nix
|
./services/misc/logkeys.nix
|
||||||
./services/misc/leaps.nix
|
./services/misc/leaps.nix
|
||||||
./services/misc/lidarr.nix
|
./services/misc/lidarr.nix
|
||||||
|
|
78
nixos/modules/services/misc/languagetool.nix
Normal file
78
nixos/modules/services/misc/languagetool.nix
Normal file
|
@ -0,0 +1,78 @@
|
||||||
|
{ config, lib, options, pkgs, ... }:
|
||||||
|
|
||||||
|
with lib;
|
||||||
|
|
||||||
|
let
|
||||||
|
cfg = config.services.languagetool;
|
||||||
|
settingsFormat = pkgs.formats.javaProperties {};
|
||||||
|
in {
|
||||||
|
options.services.languagetool = {
|
||||||
|
enable = mkEnableOption (mdDoc "the LanguageTool server");
|
||||||
|
|
||||||
|
port = mkOption {
|
||||||
|
type = types.port;
|
||||||
|
default = 8081;
|
||||||
|
example = 8081;
|
||||||
|
description = mdDoc ''
|
||||||
|
Port on which LanguageTool listens.
|
||||||
|
'';
|
||||||
|
};
|
||||||
|
|
||||||
|
public = mkEnableOption (mdDoc "access from anywhere (rather than just localhost)");
|
||||||
|
|
||||||
|
allowOrigin = mkOption {
|
||||||
|
type = types.nullOr types.str;
|
||||||
|
default = null;
|
||||||
|
example = "https://my-website.org";
|
||||||
|
description = mdDoc ''
|
||||||
|
Set the Access-Control-Allow-Origin header in the HTTP response,
|
||||||
|
used for direct (non-proxy) JavaScript-based access from browsers.
|
||||||
|
`null` to allow access from all sites.
|
||||||
|
'';
|
||||||
|
};
|
||||||
|
|
||||||
|
settings = lib.mkOption {
|
||||||
|
type = types.submodule {
|
||||||
|
freeformType = settingsFormat.type;
|
||||||
|
|
||||||
|
options.cacheSize = mkOption {
|
||||||
|
type = types.ints.unsigned;
|
||||||
|
default = 1000;
|
||||||
|
apply = toString;
|
||||||
|
description = mdDoc "Number of sentences cached.";
|
||||||
|
};
|
||||||
|
};
|
||||||
|
default = {};
|
||||||
|
description = mdDoc ''
|
||||||
|
Configuration file options for LanguageTool, see
|
||||||
|
'languagetool-http-server --help'
|
||||||
|
for supported settings.
|
||||||
|
'';
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
config = mkIf cfg.enable {
|
||||||
|
|
||||||
|
systemd.services.languagetool = {
|
||||||
|
description = "LanguageTool HTTP server";
|
||||||
|
wantedBy = [ "multi-user.target" ];
|
||||||
|
after = [ "network.target" ];
|
||||||
|
serviceConfig = {
|
||||||
|
DynamicUser = true;
|
||||||
|
User = "languagetool";
|
||||||
|
Group = "languagetool";
|
||||||
|
CapabilityBoundingSet = [ "" ];
|
||||||
|
RestrictNamespaces = [ "" ];
|
||||||
|
SystemCallFilter = [ "@system-service" "~ @privileged" ];
|
||||||
|
ProtectHome = "yes";
|
||||||
|
ExecStart = ''
|
||||||
|
${pkgs.languagetool}/bin/languagetool-http-server \
|
||||||
|
--port ${toString cfg.port} \
|
||||||
|
${optionalString cfg.public "--public"} \
|
||||||
|
${optionalString (cfg.allowOrigin != null) "--allow-origin ${cfg.allowOrigin}"} \
|
||||||
|
"--configuration" ${settingsFormat.generate "languagetool.conf" cfg.settings}
|
||||||
|
'';
|
||||||
|
};
|
||||||
|
};
|
||||||
|
};
|
||||||
|
}
|
|
@ -276,6 +276,7 @@ in {
|
||||||
krb5 = discoverTests (import ./krb5 {});
|
krb5 = discoverTests (import ./krb5 {});
|
||||||
ksm = handleTest ./ksm.nix {};
|
ksm = handleTest ./ksm.nix {};
|
||||||
kubernetes = handleTestOn ["x86_64-linux"] ./kubernetes {};
|
kubernetes = handleTestOn ["x86_64-linux"] ./kubernetes {};
|
||||||
|
languagetool = handleTest ./languagetool.nix {};
|
||||||
latestKernel.login = handleTest ./login.nix { latestKernel = true; };
|
latestKernel.login = handleTest ./login.nix { latestKernel = true; };
|
||||||
leaps = handleTest ./leaps.nix {};
|
leaps = handleTest ./leaps.nix {};
|
||||||
lemmy = handleTest ./lemmy.nix {};
|
lemmy = handleTest ./lemmy.nix {};
|
||||||
|
|
19
nixos/tests/languagetool.nix
Normal file
19
nixos/tests/languagetool.nix
Normal file
|
@ -0,0 +1,19 @@
|
||||||
|
import ./make-test-python.nix ({ pkgs, lib, ... }:
|
||||||
|
let port = 8082;
|
||||||
|
in {
|
||||||
|
name = "languagetool";
|
||||||
|
meta = with lib.maintainers; { maintainers = [ fbeffa ]; };
|
||||||
|
|
||||||
|
nodes.machine = { ... }:
|
||||||
|
{
|
||||||
|
services.languagetool.enable = true;
|
||||||
|
services.languagetool.port = port;
|
||||||
|
};
|
||||||
|
|
||||||
|
testScript = ''
|
||||||
|
machine.start()
|
||||||
|
machine.wait_for_unit("languagetool.service")
|
||||||
|
machine.wait_for_open_port(${toString port})
|
||||||
|
machine.wait_until_succeeds('curl -d "language=en-US" -d "text=a simple test" http://localhost:${toString port}/v2/check')
|
||||||
|
'';
|
||||||
|
})
|
Loading…
Reference in a new issue