services: paperless: setup reverse proxy

This commit is contained in:
Antoine Martin 2021-07-12 19:07:39 +02:00
parent df3cffadaf
commit 95733f9e05
3 changed files with 41 additions and 0 deletions

View file

@ -120,6 +120,11 @@ in
enable = true; enable = true;
}; };
paperless = {
enable = true;
port = 8085;
};
postgresql-backup = { postgresql-backup = {
enable = true; enable = true;
}; };

View file

@ -15,6 +15,7 @@
./nextcloud.nix ./nextcloud.nix
./nginx.nix ./nginx.nix
./nuage.nix ./nuage.nix
./paperless.nix
./pipewire.nix ./pipewire.nix
./postgresql-backup.nix ./postgresql-backup.nix
./postgresql.nix ./postgresql.nix

35
services/paperless.nix Normal file
View file

@ -0,0 +1,35 @@
{ config, lib, pkgs, ... }:
with lib;
let
cfg = config.my.services.paperless;
my = config.my;
domain = config.networking.domain;
in
{
options.my.services.paperless = {
enable = lib.mkEnableOption "Paperless";
port = mkOption {
type = types.port;
default = 8080;
example = 8080;
description = "Internal port for Paperless service";
};
};
config = mkIf cfg.enable {
services.nginx.virtualHosts = {
"paperless.${domain}" = {
forceSSL = true;
enableACME = true;
locations."/" = {
proxyPass = "http://127.0.0.1:${toString cfg.port}";
proxyWebsockets = true;
};
};
};
};
}