65 lines
2.1 KiB
Nix
65 lines
2.1 KiB
Nix
{ config, lib, ... }:
|
|
with lib;
|
|
let
|
|
common = config.selfhosted.common;
|
|
rootCfg = config.selfhosted.docs-manager;
|
|
cfg = rootCfg.paperless-ngx;
|
|
domain = "${config.sops.placeholder."domains/serv"}";
|
|
pocketIdSubdomain = config.selfhosted.pocket-id.subdomain;
|
|
socialAccountProviders = builtins.toJSON {
|
|
openid_connect = {
|
|
OAUTH_PKCE_ENABLED = true;
|
|
SCOPE = [
|
|
"openid"
|
|
"profile"
|
|
"email"
|
|
];
|
|
APPS = [
|
|
{
|
|
provider_id = "paperless-ngx";
|
|
name = "PocketID";
|
|
client_id = "paperless-ngx";
|
|
secret = config.sops.placeholder."paperless-ngx/client_secret";
|
|
settings = {
|
|
server_url = "https://${pocketIdSubdomain}.${domain}";
|
|
token_auth_method = "client_secret_basic";
|
|
fetch_userinfo = true;
|
|
};
|
|
}
|
|
];
|
|
};
|
|
};
|
|
in
|
|
{
|
|
config = mkIf rootCfg.enable {
|
|
sops.secrets = {
|
|
"paperless-ngx/client_secret" = { };
|
|
"paperless-ngx/secret_key" = { };
|
|
};
|
|
|
|
sops.templates."paperless-ngx.env".content = ''
|
|
USERMAP_UID=${common.user.uid}
|
|
USERMAP_GID=${common.group.gid}
|
|
PAPERLESS_URL=https://${cfg.subdomain}.${domain}
|
|
PAPERLESS_SECRET_KEY=${config.sops.placeholder."paperless-ngx/secret_key"}
|
|
PAPERLESS_TIME_ZONE=${config.time.timeZone}
|
|
PAPERLESS_REDIS=redis://${rootCfg.redis.name}:6379
|
|
PAPERLESS_DBENGINE=postgresql
|
|
PAPERLESS_DBHOST=${rootCfg.postgres.name}
|
|
PAPERLESS_DBPORT=5432
|
|
PAPERLESS_DBNAME=paperless
|
|
PAPERLESS_DBUSER=paperless
|
|
PAPERLESS_DBPASS=${config.sops.placeholder."paperless-ngx/db_password"}
|
|
PAPERLESS_APPS=allauth.socialaccount.providers.openid_connect
|
|
PAPERLESS_SOCIAL_AUTO_SIGNUP=true
|
|
PAPERLESS_SOCIAL_ACCOUNT_DEFAULT_GROUPS=users
|
|
PAPERLESS_ACCOUNT_EMAIL_VERIFICATION=none
|
|
PAPERLESS_SOCIALACCOUNT_PROVIDERS=${socialAccountProviders}
|
|
|
|
PAPERLESS_TIKA_ENABLED=1
|
|
PAPERLESS_TIKA_GOTENBERG_ENDPOINT=http://${rootCfg.tika.gotenbergName}:3000
|
|
PAPERLESS_TIKA_ENDPOINT=http://${rootCfg.tika.name}:9998
|
|
'';
|
|
};
|
|
}
|