From f0721f377955cbd33a3613750b43629580ade724 Mon Sep 17 00:00:00 2001 From: e1mo Date: Fri, 19 Apr 2024 10:45:08 +0200 Subject: [PATCH 1/2] nixos/paperless: Always buidl tesseract with english With the changes introduced in #303388 tesseract would only be compiled with the languages defined in `PAPERLESS_OCR_LANGUAGE`. However, english is always required, making tesseract fail to build when only non-english languages are defined in tesseract: ``` eng.traineddata must be present in tessdata for Tesseract to work ``` --- nixos/modules/services/misc/paperless.nix | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/nixos/modules/services/misc/paperless.nix b/nixos/modules/services/misc/paperless.nix index 3456098073b3..e564fe3b8317 100644 --- a/nixos/modules/services/misc/paperless.nix +++ b/nixos/modules/services/misc/paperless.nix @@ -203,9 +203,12 @@ in apply = pkg: pkg.override { tesseract5 = pkg.tesseract5.override { # always enable detection modules + # tesseract fails to build when eng is not present enableLanguages = if cfg.settings ? PAPERLESS_OCR_LANGUAGE then - [ "equ" "osd" ] + lists.unique ( + [ "equ" "osd" "eng" ] ++ lib.splitString "+" cfg.settings.PAPERLESS_OCR_LANGUAGE + ) else null; }; }; From 7067c4b0bb925263b848a895fcca03e4934d438f Mon Sep 17 00:00:00 2001 From: e1mo Date: Fri, 19 Apr 2024 10:40:19 +0200 Subject: [PATCH 2/2] nixosTests.paperless: Test tesseract compiles when english is not staged Tests for the regression introduced in #303388 and fixed in f0721f377955. --- nixos/tests/paperless.nix | 1 + 1 file changed, 1 insertion(+) diff --git a/nixos/tests/paperless.nix b/nixos/tests/paperless.nix index 3d834b29958d..3ef291ba7e06 100644 --- a/nixos/tests/paperless.nix +++ b/nixos/tests/paperless.nix @@ -23,6 +23,7 @@ import ./make-test-python.nix ({ lib, ... }: { }; services.paperless.settings = { PAPERLESS_DBHOST = "/run/postgresql"; + PAPERLESS_OCR_LANGUAGE = "deu"; }; }; }; in self;