From 55a3807844243253753c39c1d940456b9f9f2afa Mon Sep 17 00:00:00 2001
From: Andrea Ciceri <andrea.ciceri@autistici.org>
Date: Thu, 2 Jan 2025 17:16:23 +0100
Subject: [PATCH] Move nginx paperless proxy configuration to relative module

---
 modules/paperless/default.nix   | 13 +++++++++++++
 modules/sisko-proxy/default.nix |  7 -------
 2 files changed, 13 insertions(+), 7 deletions(-)

diff --git a/modules/paperless/default.nix b/modules/paperless/default.nix
index 4918ed7..e1e01fb 100644
--- a/modules/paperless/default.nix
+++ b/modules/paperless/default.nix
@@ -22,4 +22,17 @@
   environment.persistence."/persist".directories = [
     config.services.paperless.dataDir
   ];
+
+  imports = [ ../nginx-base ];
+
+  services.nginx.virtualHosts."paper.aciceri.dev" = {
+    forceSSL = true;
+    enableACME = true;
+    locations."/" = {
+      proxyPass = "http://localhost:${builtins.toString config.services.paperless.port}";
+    };
+    extraConfig = ''
+      client_max_body_size 50000M;
+    '';
+  };
 }
diff --git a/modules/sisko-proxy/default.nix b/modules/sisko-proxy/default.nix
index c6c1a7b..353af1b 100644
--- a/modules/sisko-proxy/default.nix
+++ b/modules/sisko-proxy/default.nix
@@ -47,13 +47,6 @@
         proxyWebsockets = true;
       };
     };
-    "paper.aciceri.dev" = {
-      forceSSL = true;
-      enableACME = true;
-      locations."/" = {
-        proxyPass = "http://localhost:${builtins.toString config.services.paperless.port}";
-      };
-    };
     # "${config.services.nextcloud.hostName}" = {
     #   forceSSL = true;
     #   enableACME = true;