updates and stuff

This commit is contained in:
mjallen18
2025-01-13 17:13:44 -06:00
parent 280518e260
commit a774f7eb41
14 changed files with 200 additions and 163 deletions

View File

@@ -0,0 +1,28 @@
{ lib, config, ... }:
with lib;
let
cfg = config.nas-apps.paperless-ai;
in
{
imports = [ ./options.nix ];
config = mkIf cfg.enable {
virtualisation.oci-containers.containers.${cfg.name} = {
autoStart = true;
image = cfg.image;
extraOptions = [ "--device=nvidia.com/gpu=0" "--network=bridge" "--add-host=host.docker.internal:host-gateway" ];
volumes = [ "${cfg.configPath}:/app/data" ];
ports = [ "${cfg.port}:3000" ];
environment = {
NVIDIA_VISIBLE_DEVICES = "all";
NVIDIA_DRIVER_CAPABILITIES = "all";
PAPERLESS_API_URL = "http://10.0.1.20:28981";
PAPERLESS_API_TOKEN = "6f26e1a4632f23bc2da5b74c799ccbda18fa8022";
PUID = cfg.puid;
PGID = cfg.pgid;
TZ = cfg.timeZone;
};
};
};
}

View File

@@ -0,0 +1,47 @@
{ lib, ... }:
with lib;
{
options.nas-apps.paperless-ai = {
enable = mkEnableOption "paperless-ai docker service";
autoStart = mkOption {
type = types.bool;
default = true;
};
port = mkOption {
type = types.str;
default = "3000";
};
name = mkOption {
type = types.str;
default = "paperless-ai";
};
image = mkOption {
type = types.str;
default = "clusterzx/paperless-ai";
};
configPath = mkOption {
type = types.str;
default = "/media/nas/ssd/nix-app-data/paperless-ai";
};
puid = mkOption {
type = types.str;
default = "911";
};
pgid = mkOption {
type = types.str;
default = "1000";
};
timeZone = mkOption {
type = types.str;
default = "America/Chicago";
};
};
}

View File

@@ -35,14 +35,13 @@ in
user = "paperless";
address = "0.0.0.0";
passwordFile = "/var/lib/paperless/paperless-password";
# settings = {
# PAPERLESS_APPS="allauth.socialaccount.providers.openid_connect";
# PAPERLESS_SOCIALACCOUNT_PROVIDERS = {
# "openid_connect" = {
# "OAUTH_PKCE_ENABLED":true,
# "APPS":[
# {"provider_id":"authentik","name":"Authentik","client_id":"<Client ID>","secret":<Client Secret>","settings":{"server_url":"https://authentik.mjallen.dev/application/o/paperless/.well-known/openid-configuration"}}]}}
# }
settings = {
PAPERLESS_URL = "https://paperless.jallen.dev";
PAPERLESS_SECRET = "Luciferthecat03092024";
PAPERLESS_ENABLE_ALLAUTH = true;
PAPERLESS_APPS = "allauth.socialaccount.providers.openid_connect";
PAPERLESS_SOCIALACCOUNT_PROVIDERS=''{"openid_connect":{"OAUTH_PKCE_ENABLED":true,"APPS":[{"provider_id":"authentik","name":"authentik","client_id":"OZhMnBUxwJvpjkUhs4ISgA0iAWA7etgTXaohLCED","secret":"UrwdWObeyoEI1AogXcjV8SwYsJ585Wkh5YxDH5wFPXZxp8IVV9QNsn32PIAv6h9BdjaiiMrOFayaW3uXyZYg71olG5OQ1qGaD6WYn0EijYBwxoEuvp7LIdMJ4lImhVR1","settings":{"server_url":"https://authentik.mjallen.dev/application/o/paperless/.well-known/openid-configuration"}}]}}'';
};
};
# Create required users and groups

View File

@@ -10,6 +10,7 @@ let
jellyseerrUrl = "http://10.0.1.52:5055";
hassUrl = "http://10.0.1.183:8123";
openWebUIUrl = "http://10.0.1.18:8888";
paperlessUrl = "http://10.0.1.20:28981";
in
{
networking.firewall = {
@@ -147,6 +148,11 @@ in
url = openWebUIUrl;
}
];
paperless.loadBalancer.servers = [
{
url = paperlessUrl;
}
];
};
routers = {
@@ -203,6 +209,12 @@ in
priority = 10;
tls.certResolver = "letsencrypt";
};
# paperless = {
# entryPoints = ["websecure"];
# rule = "Host(`paperless.${domain}`)";
# service = "paperless";
# tls.certResolver = "letsencrypt";
# };
};
};
};