Files
NixOS/modules/servers/paperless.nix
Danilo Reyes 2eafb66a2b port to string
2025-12-10 12:44:52 -06:00

35 lines
1.2 KiB
Nix

{ lib, config, ... }:
let
cfg = config.my.servers.paperless;
port = builtins.toString config.services.paperless.port;
in
{
options.my.servers.paperless.enable = lib.mkEnableOption "Paperless-ngx document management system";
config = lib.mkIf (cfg.enable && config.my.servers.postgres.enable) {
networking.firewall.allowedTCPPorts = [ port ];
services.paperless = {
inherit (cfg) enable;
address = config.my.ips.server;
consumptionDirIsPublic = true;
consumptionDir = "/srv/pool/scans/";
settings = {
PAPERLESS_ACCOUNT_DEFAULT_HTTP_PROTOCOL = "http";
PAPERLESS_URL = "http://${config.my.ips.server}:${port}";
PAPERLESS_DBENGINE = "postgress";
PAPERLESS_DBNAME = "paperless";
PAPERLESS_DBHOST = config.my.postgresSocket;
PAPERLESS_TIME_ZONE = config.my.timeZone;
PAPERLESS_APPS = "allauth.socialaccount.providers.openid_connect";
PAPERLESS_CONSUMER_IGNORE_PATTERN = builtins.toJSON [
".DS_STORE/*"
"desktop.ini"
];
PAPERLESS_OCR_USER_ARGS = builtins.toJSON {
optimize = 1;
pdfa_image_compression = "lossless";
};
};
};
};
}