56 lines
1.3 KiB
Nix
56 lines
1.3 KiB
Nix
{ config, pkgs, lib, ... }:
|
|
|
|
with lib;
|
|
|
|
let
|
|
cfg = config.services.naxos.apps.paperless;
|
|
in {
|
|
options.services.naxos.apps.paperless = {
|
|
enable = mkEnableOption "Paperless-ngx Document Archiving System";
|
|
|
|
port = mkOption {
|
|
type = types.port;
|
|
default = 28981;
|
|
description = "Web interface port.";
|
|
};
|
|
|
|
mediaDir = mkOption {
|
|
type = types.str;
|
|
default = "/tank/data/paperless/media";
|
|
description = "Directory where archived documents and OCR results are stored.";
|
|
};
|
|
|
|
consumptionDir = mkOption {
|
|
type = types.str;
|
|
default = "/tank/scans";
|
|
description = "Ingestion directory where scanner uploads incoming documents.";
|
|
};
|
|
|
|
openFirewall = mkOption {
|
|
type = types.bool;
|
|
default = true;
|
|
description = "Open port in firewall.";
|
|
};
|
|
};
|
|
|
|
config = mkIf cfg.enable {
|
|
services.paperless = {
|
|
enable = true;
|
|
port = cfg.port;
|
|
mediaDir = cfg.mediaDir;
|
|
consumptionDir = cfg.consumptionDir;
|
|
settings = {
|
|
PAPERLESS_OCR_LANGUAGE = "deu+eng";
|
|
PAPERLESS_CONSUMER_POLLING = 30;
|
|
};
|
|
};
|
|
|
|
networking.firewall.allowedTCPPorts = mkIf cfg.openFirewall [ cfg.port ];
|
|
|
|
systemd.tmpfiles.rules = [
|
|
"d ${cfg.mediaDir} 0750 paperless paperless -"
|
|
"d ${cfg.consumptionDir} 0775 paperless users -"
|
|
];
|
|
};
|
|
}
|