9 cfg = config.services.tika;
21 meta.maintainers = [ lib.maintainers.drupol ];
25 enable = mkEnableOption "Apache Tika server";
26 package = mkPackageOption pkgs "tika" { };
28 listenAddress = mkOption {
30 default = "127.0.0.1";
33 The Apache Tika bind address.
41 The Apache Tike port to listen on
45 configFile = mkOption {
46 type = types.nullOr types.path;
49 The Apache Tika configuration (XML) file to use.
51 example = literalExpression "./tika/tika-config.xml";
54 enableOcr = mkOption {
58 Whether to enable OCR support by adding the `tesseract` package as a dependency.
62 openFirewall = mkOption {
66 Whether to open the firewall for Apache Tika.
67 This adds `services.tika.port` to `networking.firewall.allowedTCPPorts`.
73 config = mkIf cfg.enable {
74 systemd.services.tika = {
75 description = "Apache Tika Server";
77 wantedBy = [ "multi-user.target" ];
78 after = [ "network.target" ];
82 package = cfg.package.override { inherit (cfg) enableOcr; };
87 ExecStart = "${getExe package} --host ${cfg.listenAddress} --port ${toString cfg.port} ${
88 lib.optionalString (cfg.configFile != null) "--config ${cfg.configFile}"
91 StateDirectory = "tika";
92 CacheDirectory = "tika";
96 networking.firewall = mkIf cfg.openFirewall { allowedTCPPorts = [ cfg.port ]; };