From 8e8e24fc68f3ee72a0be1f6bf9811df3215a4e4f Mon Sep 17 00:00:00 2001 From: Pol Dellaiera Date: Wed, 17 Jul 2024 20:41:52 +0200 Subject: [PATCH] tika: add `enableOcr` option --- nix/services/tika.nix | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) diff --git a/nix/services/tika.nix b/nix/services/tika.nix index 06a2e116..6ee6f96e 100644 --- a/nix/services/tika.nix +++ b/nix/services/tika.nix @@ -19,6 +19,14 @@ in type = types.port; }; + enableOcr = lib.mkOption { + default = true; + description = '' + Whether to enable OCR support by adding the `tesseract` package as a dependency. + ''; + type = types.bool; + }; + configFile = lib.mkOption { type = types.nullOr types.path; default = null; @@ -33,8 +41,12 @@ in outputs = { settings = { processes = { - "${name}" = { - command = "${lib.getExe config.package} --host ${config.host} --port ${toString config.port} ${lib.optionalString (config.configFile != null) "--config ${config.configFile}"}"; + "${name}" = let + tikaPackage = config.package.override { + enableOcr = config.enableOcr; + }; + in { + command = "${lib.getExe tikaPackage} --host ${config.host} --port ${toString config.port} ${lib.optionalString (config.configFile != null) "--config ${config.configFile}"}"; availability.restart = "on_failure"; readiness_probe = { http_get = {