From 6ee162822e7839fdd932e395bbc909326e0b0913 Mon Sep 17 00:00:00 2001 From: marthsincemelee Date: Sun, 10 Mar 2024 21:09:49 +0100 Subject: [PATCH] Feature: Paperless --- machines/jupiter/environments.nix | 8 +++++++ modules/environments/paperless/default.nix | 27 ++++++++++++++++++---- 2 files changed, 31 insertions(+), 4 deletions(-) diff --git a/machines/jupiter/environments.nix b/machines/jupiter/environments.nix index 15d0ddd..84c331a 100644 --- a/machines/jupiter/environments.nix +++ b/machines/jupiter/environments.nix @@ -18,6 +18,14 @@ in sonarr.enable = true; jellyfin.enable = true; jellyseerr.enable = true; + paperless = { + enable = true; + port = 28981; # Optional, to override the default port + extraConfig = { + PAPERLESS_ADMIN_USER = "finn"; + PAPERLESS_OCR_LANGUAGE = "deu+eng"; + }; + }; prowlarr.enable = true; }; diff --git a/modules/environments/paperless/default.nix b/modules/environments/paperless/default.nix index 91e9df7..10faabd 100644 --- a/modules/environments/paperless/default.nix +++ b/modules/environments/paperless/default.nix @@ -8,10 +8,29 @@ in enable = mkEnableOption "Paperless Server"; port = mkOption { - type = types.port; - default = 28981; - example = 8081; - description = "Internal port for webui"; + type = types.port; + default = 28981; + example = 8080; + description = "Internal port for webui"; + }; + + extraConfig = mkOption { + type = types.attrs; + default = {}; + example = { PAPERLESS_OCR_LANGUAGE = "deu+eng"; }; + description = "Extra configuration options"; + }; + }; + + config = lib.mkIf cfg.enable { + services.paperless = { + enable = true; + address = "0.0.0.0"; + dataDir = "/data/nfs/arr-data/documents/paperless"; + #inherit (cfg) port extraConfig; + port = cfg.port; + extraConfig = cfg.extraConfig; }; + networking.firewall.allowedTCPPorts = [ cfg.port ]; }; } \ No newline at end of file