46 lines
1.1 KiB
Nix
46 lines
1.1 KiB
Nix
# SPDX-FileCopyrightText: 2024 Simon Bruder <simon@sbruder.de>
|
|
#
|
|
# SPDX-License-Identifier: AGPL-3.0-or-later
|
|
|
|
{ config, lib, ... }:
|
|
|
|
{
|
|
services.postgresql = {
|
|
enable = true;
|
|
ensureDatabases = [ "paperless" ];
|
|
ensureUsers = lib.singleton {
|
|
name = "paperless";
|
|
ensureDBOwnership = true;
|
|
};
|
|
};
|
|
|
|
services.paperless = {
|
|
enable = true;
|
|
settings = {
|
|
PAPERLESS_DBHOST = "/run/postgresql";
|
|
PAPERLESS_URL = "https://paperless.sbruder.de";
|
|
PAPERLESS_OCR_LANGUAGE = "deu+eng";
|
|
PAPERLESS_TASK_WORKERS = 4;
|
|
PAPERLESS_TIME_ZONE = "Europe/Berlin";
|
|
PAPERLESS_FILENAME_FORMAT = "{correspondent}/{document_type}/{created}_{title}_{doc_pk}";
|
|
};
|
|
};
|
|
|
|
services.nginx = {
|
|
enable = true;
|
|
|
|
virtualHosts."paperless.sbruder.de" = {
|
|
enableACME = true;
|
|
forceSSL = true;
|
|
|
|
locations = {
|
|
"/" = {
|
|
proxyPass = with config.services.paperless; "http://${address}:${toString port}";
|
|
proxyWebsockets = true;
|
|
};
|
|
"/static".root = "${config.services.paperless.package}/lib/paperless-ngx";
|
|
};
|
|
};
|
|
};
|
|
}
|