fuuko: Add paperless
This commit is contained in:
parent
29f1052795
commit
cfdce40a92
|
@ -11,6 +11,7 @@
|
|||
|
||||
./services/media-backup.nix
|
||||
./services/media.nix
|
||||
./services/paperless.nix
|
||||
./services/photoprism.nix
|
||||
./services/torrent.nix
|
||||
];
|
||||
|
@ -53,4 +54,20 @@
|
|||
networking.hostName = "fuuko";
|
||||
|
||||
system.stateVersion = "20.09";
|
||||
|
||||
services.postgresql = {
|
||||
enable = true;
|
||||
package = pkgs.postgresql_16;
|
||||
};
|
||||
|
||||
services.postgresqlBackup = {
|
||||
enable = true;
|
||||
startAt = [ ]; # triggered by restic system backup
|
||||
location = "/var/lib/postgresql-backup";
|
||||
compression = "none";
|
||||
};
|
||||
systemd.services.restic-backups-system = {
|
||||
after = [ "postgresqlBackup.service" ];
|
||||
wants = [ "postgresqlBackup.service" ];
|
||||
};
|
||||
}
|
||||
|
|
45
machines/fuuko/services/paperless.nix
Normal file
45
machines/fuuko/services/paperless.nix
Normal file
|
@ -0,0 +1,45 @@
|
|||
# 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";
|
||||
};
|
||||
};
|
||||
};
|
||||
}
|
Loading…
Reference in a new issue