Skip to content

Commit

Permalink
feat(tika): add enableOcr option (#275)
Browse files Browse the repository at this point in the history
Following `nixpkgs` PR @ NixOS/nixpkgs#327886,
this PR add the `enableOcr` option.
  • Loading branch information
drupol authored Jul 21, 2024
1 parent cfaa952 commit 3e023c9
Showing 1 changed file with 27 additions and 13 deletions.
40 changes: 27 additions & 13 deletions nix/services/tika.nix
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -33,21 +41,27 @@ 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}"}";
availability.restart = "on_failure";
readiness_probe = {
http_get = {
host = config.host;
port = config.port;
"${name}" =
let
tikaPackage = config.package.override {
inherit (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 = {
host = config.host;
port = config.port;
};
initial_delay_seconds = 2;
period_seconds = 10;
timeout_seconds = 4;
success_threshold = 1;
failure_threshold = 5;
};
initial_delay_seconds = 2;
period_seconds = 10;
timeout_seconds = 4;
success_threshold = 1;
failure_threshold = 5;
};
};
};
};
};
Expand Down

0 comments on commit 3e023c9

Please sign in to comment.