Files
nixos/hosts/common/optional/selfhosted/docs-manager/paperless-ngx/config.nix
T
aloslider c92b90e406 Small modules config restructure
Changed variables names in every module
2026-10-31 19:48:50 +03:00

68 lines
2.2 KiB
Nix

{ config, lib, ... }:
with lib;
let
rootCfg = config.selfhosted;
common = rootCfg.common;
moduleCfg = rootCfg.docs-manager;
cfg = moduleCfg.paperless-ngx;
domain = "${config.sops.placeholder."domains/serv"}";
pocketIdSubdomain = rootCfg.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 moduleCfg.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://${moduleCfg.redis.name}:6379
PAPERLESS_DBENGINE=postgresql
PAPERLESS_DBHOST=${moduleCfg.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_OCR_LANGUAGE=eng+rus
PAPERLESS_OCR_LANGUAGES=eng rus
PAPERLESS_TIKA_ENABLED=1
PAPERLESS_TIKA_GOTENBERG_ENDPOINT=http://${moduleCfg.tika.gotenbergName}:3000
PAPERLESS_TIKA_ENDPOINT=http://${moduleCfg.tika.name}:9998
'';
};
}