|
358 | 358 | description = "Settings to pass to the document exporter as CLI arguments."; |
359 | 359 | }; |
360 | 360 | }; |
| 361 | + |
| 362 | + configureTika = lib.mkOption { |
| 363 | + type = lib.types.bool; |
| 364 | + default = false; |
| 365 | + description = '' |
| 366 | + Whether to configure Tika and Gotenberg to process Office and e-mail files with OCR. |
| 367 | + ''; |
| 368 | + }; |
361 | 369 | }; |
362 | 370 |
|
363 | 371 | config = lib.mkIf cfg.enable ( |
|
378 | 386 | ]; |
379 | 387 | }; |
380 | 388 |
|
381 | | - services.paperless.settings = lib.mkIf cfg.database.createLocally { |
382 | | - PAPERLESS_DBENGINE = "postgresql"; |
383 | | - PAPERLESS_DBHOST = "/run/postgresql"; |
384 | | - PAPERLESS_DBNAME = "paperless"; |
385 | | - PAPERLESS_DBUSER = "paperless"; |
386 | | - }; |
| 389 | + services.paperless.settings = lib.mkMerge [ |
| 390 | + (lib.mkIf cfg.database.createLocally { |
| 391 | + PAPERLESS_DBENGINE = "postgresql"; |
| 392 | + PAPERLESS_DBHOST = "/run/postgresql"; |
| 393 | + PAPERLESS_DBNAME = "paperless"; |
| 394 | + PAPERLESS_DBUSER = "paperless"; |
| 395 | + }) |
| 396 | + (lib.mkIf cfg.configureTika { |
| 397 | + PAPERLESS_GOTENBERG_ENABLED = true; |
| 398 | + PAPERLESS_TIKA_ENABLED = true; |
| 399 | + }) |
| 400 | + ]; |
387 | 401 |
|
388 | 402 | systemd.slices.system-paperless = { |
389 | 403 | description = "Paperless Document Management System Slice"; |
|
571 | 585 | gid = config.ids.gids.paperless; |
572 | 586 | }; |
573 | 587 | }; |
| 588 | + |
| 589 | + services.gotenberg = lib.mkIf cfg.configureTika { |
| 590 | + enable = true; |
| 591 | + # https://github.com/paperless-ngx/paperless-ngx/blob/v2.15.3/docker/compose/docker-compose.sqlite-tika.yml#L64-L69 |
| 592 | + chromium.disableJavascript = true; |
| 593 | + extraArgs = [ "--chromium-allow-list=file:///tmp/.*" ]; |
| 594 | + }; |
| 595 | + |
| 596 | + services.tika = lib.mkIf cfg.configureTika { |
| 597 | + enable = true; |
| 598 | + enableOcr = true; |
| 599 | + }; |
574 | 600 | } |
575 | 601 |
|
576 | 602 | (lib.mkIf cfg.exporter.enable { |
|
0 commit comments