nix-conf/system/modules/paperless-ngx.nix
2026-01-20 13:41:53 +08:00

35 lines
860 B
Nix
Executable file

{
domain ? "localhost",
configureNginx ? true,
passwordFile,
}:
{ config, lib, ... }:
let
inherit (lib) mkIf optionalString;
in
{
services.paperless = {
enable = true;
passwordFile = passwordFile;
consumptionDirIsPublic = true;
settings = {
PAPERLESS_CONSUMER_IGNORE_PATTERN = [
".DS_STORE/*"
"desktop.ini"
];
PAPERLESS_OCR_LANGUAGE = "chi_tra+eng";
PAPERLESS_OCR_USER_ARGS = {
optimize = 1;
pdfa_image_compression = "lossless";
};
PAPERLESS_URL = "http${optionalString configureNginx "s"}://${domain}";
};
configureTika = false;
database.createLocally = true;
};
services.nginx.virtualHosts."${domain}" = mkIf configureNginx {
forceSSL = true;
locations."/".proxyPass = "http://127.0.0.1:${toString config.services.paperless.port}";
};
}