diff options
-rw-r--r-- | nixos/modules/services/misc/languagetool.nix | 37 |
1 files changed, 17 insertions, 20 deletions
diff --git a/nixos/modules/services/misc/languagetool.nix b/nixos/modules/services/misc/languagetool.nix index 2a7e68c9053a..c2921ea0f047 100644 --- a/nixos/modules/services/misc/languagetool.nix +++ b/nixos/modules/services/misc/languagetool.nix @@ -1,19 +1,16 @@ { config, lib, pkgs, ... }: - -with lib; - let cfg = config.services.languagetool; settingsFormat = pkgs.formats.javaProperties { }; in { options.services.languagetool = { - enable = mkEnableOption "the LanguageTool server, a multilingual spelling, style, and grammar checker that helps correct or paraphrase texts"; + enable = lib.mkEnableOption "the LanguageTool server, a multilingual spelling, style, and grammar checker that helps correct or paraphrase texts"; - package = mkPackageOption pkgs "languagetool" { }; + package = lib.mkPackageOption pkgs "languagetool" { }; - port = mkOption { - type = types.port; + port = lib.mkOption { + type = lib.types.port; default = 8081; example = 8081; description = '' @@ -21,10 +18,10 @@ in ''; }; - public = mkEnableOption "access from anywhere (rather than just localhost)"; + public = lib.mkEnableOption "access from anywhere (rather than just localhost)"; - allowOrigin = mkOption { - type = types.nullOr types.str; + allowOrigin = lib.mkOption { + type = lib.types.nullOr lib.types.str; default = null; example = "https://my-website.org"; description = '' @@ -34,12 +31,12 @@ in ''; }; - settings = mkOption { - type = types.submodule { + settings = lib.mkOption { + type = lib.types.submodule { freeformType = settingsFormat.type; - options.cacheSize = mkOption { - type = types.ints.unsigned; + options.cacheSize = lib.mkOption { + type = lib.types.ints.unsigned; default = 1000; apply = toString; description = "Number of sentences cached."; @@ -53,22 +50,22 @@ in ''; }; - jrePackage = mkPackageOption pkgs "jre" { }; + jrePackage = lib.mkPackageOption pkgs "jre" { }; - jvmOptions = mkOption { + jvmOptions = lib.mkOption { description = '' Extra command line options for the JVM running languagetool. More information can be found here: https://docs.oracle.com/en/java/javase/19/docs/specs/man/java.html#standard-options-for-java ''; default = [ ]; - type = types.listOf types.str; + type = lib.types.listOf lib.types.str; example = [ "-Xmx512m" ]; }; }; - config = mkIf cfg.enable { + config = lib.mkIf cfg.enable { systemd.services.languagetool = { description = "LanguageTool HTTP server"; @@ -89,8 +86,8 @@ in ${toString cfg.jvmOptions} \ org.languagetool.server.HTTPServer \ --port ${toString cfg.port} \ - ${optionalString cfg.public "--public"} \ - ${optionalString (cfg.allowOrigin != null) "--allow-origin ${cfg.allowOrigin}"} \ + ${lib.optionalString cfg.public "--public"} \ + ${lib.optionalString (cfg.allowOrigin != null) "--allow-origin ${cfg.allowOrigin}"} \ "--config" ${settingsFormat.generate "languagetool.conf" cfg.settings} ''; }; |