lol

nixos/service/languagetool: init

authored by

Federico Beffa and committed by
pennae
8be4e9e2 510ba0c7

+109
+7
nixos/doc/manual/from_md/release-notes/rl-2211.section.xml
··· 208 208 </listitem> 209 209 <listitem> 210 210 <para> 211 + <link xlink:href="https://languagetool.org/">languagetool</link>, 212 + a multilingual grammar, style, and spell checker. Available as 213 + <link xlink:href="options.html#opt-services.languagetool.enable">services.languagetool</link>. 214 + </para> 215 + </listitem> 216 + <listitem> 217 + <para> 211 218 <link xlink:href="https://www.getoutline.com/">Outline</link>, 212 219 a wiki and knowledge base similar to Notion. Available as 213 220 <link linkend="opt-services.outline.enable">services.outline</link>.
+3
nixos/doc/manual/release-notes/rl-2211.section.md
··· 76 76 - [kanata](https://github.com/jtroo/kanata), a tool to improve keyboard comfort and usability with advanced customization. 77 77 Available as [services.kanata](options.html#opt-services.kanata.enable). 78 78 79 + - [languagetool](https://languagetool.org/), a multilingual grammar, style, and spell checker. 80 + Available as [services.languagetool](options.html#opt-services.languagetool.enable). 81 + 79 82 - [Outline](https://www.getoutline.com/), a wiki and knowledge base similar to Notion. Available as [services.outline](#opt-services.outline.enable). 80 83 81 84 - [netbird](https://netbird.io), a zero configuration VPN.
+1
nixos/modules/module-list.nix
··· 589 589 ./services/misc/jackett.nix 590 590 ./services/misc/jellyfin.nix 591 591 ./services/misc/klipper.nix 592 + ./services/misc/languagetool.nix 592 593 ./services/misc/logkeys.nix 593 594 ./services/misc/leaps.nix 594 595 ./services/misc/lidarr.nix
+78
nixos/modules/services/misc/languagetool.nix
··· 1 + { config, lib, options, pkgs, ... }: 2 + 3 + with lib; 4 + 5 + let 6 + cfg = config.services.languagetool; 7 + settingsFormat = pkgs.formats.javaProperties {}; 8 + in { 9 + options.services.languagetool = { 10 + enable = mkEnableOption (mdDoc "the LanguageTool server"); 11 + 12 + port = mkOption { 13 + type = types.port; 14 + default = 8081; 15 + example = 8081; 16 + description = mdDoc '' 17 + Port on which LanguageTool listens. 18 + ''; 19 + }; 20 + 21 + public = mkEnableOption (mdDoc "access from anywhere (rather than just localhost)"); 22 + 23 + allowOrigin = mkOption { 24 + type = types.nullOr types.str; 25 + default = null; 26 + example = "https://my-website.org"; 27 + description = mdDoc '' 28 + Set the Access-Control-Allow-Origin header in the HTTP response, 29 + used for direct (non-proxy) JavaScript-based access from browsers. 30 + `null` to allow access from all sites. 31 + ''; 32 + }; 33 + 34 + settings = lib.mkOption { 35 + type = types.submodule { 36 + freeformType = settingsFormat.type; 37 + 38 + options.cacheSize = mkOption { 39 + type = types.ints.unsigned; 40 + default = 1000; 41 + apply = toString; 42 + description = mdDoc "Number of sentences cached."; 43 + }; 44 + }; 45 + default = {}; 46 + description = mdDoc '' 47 + Configuration file options for LanguageTool, see 48 + 'languagetool-http-server --help' 49 + for supported settings. 50 + ''; 51 + }; 52 + }; 53 + 54 + config = mkIf cfg.enable { 55 + 56 + systemd.services.languagetool = { 57 + description = "LanguageTool HTTP server"; 58 + wantedBy = [ "multi-user.target" ]; 59 + after = [ "network.target" ]; 60 + serviceConfig = { 61 + DynamicUser = true; 62 + User = "languagetool"; 63 + Group = "languagetool"; 64 + CapabilityBoundingSet = [ "" ]; 65 + RestrictNamespaces = [ "" ]; 66 + SystemCallFilter = [ "@system-service" "~ @privileged" ]; 67 + ProtectHome = "yes"; 68 + ExecStart = '' 69 + ${pkgs.languagetool}/bin/languagetool-http-server \ 70 + --port ${toString cfg.port} \ 71 + ${optionalString cfg.public "--public"} \ 72 + ${optionalString (cfg.allowOrigin != null) "--allow-origin ${cfg.allowOrigin}"} \ 73 + "--configuration" ${settingsFormat.generate "languagetool.conf" cfg.settings} 74 + ''; 75 + }; 76 + }; 77 + }; 78 + }
+1
nixos/tests/all-tests.nix
··· 276 276 krb5 = discoverTests (import ./krb5 {}); 277 277 ksm = handleTest ./ksm.nix {}; 278 278 kubernetes = handleTestOn ["x86_64-linux"] ./kubernetes {}; 279 + languagetool = handleTest ./languagetool.nix {}; 279 280 latestKernel.login = handleTest ./login.nix { latestKernel = true; }; 280 281 leaps = handleTest ./leaps.nix {}; 281 282 lemmy = handleTest ./lemmy.nix {};
+19
nixos/tests/languagetool.nix
··· 1 + import ./make-test-python.nix ({ pkgs, lib, ... }: 2 + let port = 8082; 3 + in { 4 + name = "languagetool"; 5 + meta = with lib.maintainers; { maintainers = [ fbeffa ]; }; 6 + 7 + nodes.machine = { ... }: 8 + { 9 + services.languagetool.enable = true; 10 + services.languagetool.port = port; 11 + }; 12 + 13 + testScript = '' 14 + machine.start() 15 + machine.wait_for_unit("languagetool.service") 16 + machine.wait_for_open_port(${toString port}) 17 + machine.wait_until_succeeds('curl -d "language=en-US" -d "text=a simple test" http://localhost:${toString port}/v2/check') 18 + ''; 19 + })