summary refs log tree commit diff
diff options
context:
space:
mode:
authorGregor Godbersen <git@doamo.de>2023-08-05 20:45:07 +0200
committerGregor Godbersen <git@doamo.de>2023-08-05 22:06:27 +0200
commit3d9a6399a1a90c8f811285672e03b19f250bad4b (patch)
tree44f2951555305fa7366d5f69cc4eeb749e0c96f9
parent540a20546a1bd40622b678d8f603d2503f1d5bd8 (diff)
downloadnixpkgs-3d9a6399a1a90c8f811285672e03b19f250bad4b.tar
nixpkgs-3d9a6399a1a90c8f811285672e03b19f250bad4b.tar.gz
nixpkgs-3d9a6399a1a90c8f811285672e03b19f250bad4b.tar.bz2
nixpkgs-3d9a6399a1a90c8f811285672e03b19f250bad4b.tar.lz
nixpkgs-3d9a6399a1a90c8f811285672e03b19f250bad4b.tar.xz
nixpkgs-3d9a6399a1a90c8f811285672e03b19f250bad4b.tar.zst
nixpkgs-3d9a6399a1a90c8f811285672e03b19f250bad4b.zip
nixos/paperless: set default thumbnail font
The upstream default for the thumbnail font is set to "Liberation Serif
Regular" located at /usr/share/fonts which is inaccessible under nix.
(https://github.com/paperless-ngx/paperless-ngx/blob/2a2bf3bf55be5c591d496d974e9b5e94b0259d28/src/paperless/settings.py#L894)

Paperless throws an error when parsing plaintext files without a valid
font. This change sets a nix default using the liberation_ttf package.
-rw-r--r--nixos/modules/services/misc/paperless.nix2
1 files changed, 2 insertions, 0 deletions
diff --git a/nixos/modules/services/misc/paperless.nix b/nixos/modules/services/misc/paperless.nix
index 1845d8ad29b..0683a1f922a 100644
--- a/nixos/modules/services/misc/paperless.nix
+++ b/nixos/modules/services/misc/paperless.nix
@@ -7,6 +7,7 @@ let
 
   defaultUser = "paperless";
   nltkDir = "/var/cache/paperless/nltk";
+  defaultFont = "${pkgs.liberation_ttf}/share/fonts/truetype/LiberationSerif-Regular.ttf";
 
   # Don't start a redis instance if the user sets a custom redis connection
   enableRedis = !hasAttr "PAPERLESS_REDIS" cfg.extraConfig;
@@ -17,6 +18,7 @@ let
     PAPERLESS_MEDIA_ROOT = cfg.mediaDir;
     PAPERLESS_CONSUMPTION_DIR = cfg.consumptionDir;
     PAPERLESS_NLTK_DIR = nltkDir;
+    PAPERLESS_THUMBNAIL_FONT_NAME = defaultFont;
     GUNICORN_CMD_ARGS = "--bind=${cfg.address}:${toString cfg.port}";
   } // optionalAttrs (config.time.timeZone != null) {
     PAPERLESS_TIME_ZONE = config.time.timeZone;