Small modules config restructure

Changed variables names in every module
This commit is contained in:
aloslider committed 2026-10-31 19:48:50 +03:00
1 parent c1d2e52bf8
commit c92b90e406
83 files changed
+616 -523

No files matched your search

@@ -1,12 +1,12 @@
{ config, lib, ... }:
with lib;
let
rootCfg = config.selfhosted.pocket-id;
moduleCfg = config.selfhosted.pocket-id;
in
{
config = mkIf rootCfg.enable {
config = mkIf moduleCfg.enable {
sops.templates."pocket-id.env".content = ''
APP_URL=https://${rootCfg.subdomain}.${config.sops.placeholder."domains/serv"}
APP_URL=https://${moduleCfg.subdomain}.${config.sops.placeholder."domains/serv"}
ENCRYPTION_KEY=${config.sops.placeholder."pocket_id/enc_key"}
TRUST_PROXY=true
ANALYTICS_DISABLED=true
@@ -1,10 +1,28 @@
{ config, lib, ... }:
{
config,
lib,
pkgs,
...
}:
with lib;
let
common = config.selfhosted.common;
rootCfg = config.selfhosted.pocket-id;
cfg = rootCfg.server;
rootCfg = config.selfhosted;
common = rootCfg.common;
moduleCfg = rootCfg.pocket-id;
cfg = moduleCfg.server;
hostDataPath = "${common.dataDir}/pocket-id";
ready = pkgs.writeShellScript "pocket-id-ready" ''
set -euo pipefail
url="http://127.0.0.1:${toString cfg.hostHttpPort}/.well-known/openid-configuration"
for i in $(seq 1 90); do
if ${lib.getExe pkgs.curl} -fsS -o /dev/null --max-time 2 "$url"; then
exit 0
fi
sleep 1
done
echo "Pocket ID did not serve $url" >&2
exit 1
'';
in
{
imports = [ ./config.nix ];
@@ -18,7 +36,7 @@ in
};
};
config = mkIf rootCfg.enable {
config = mkIf moduleCfg.enable {
virtualisation.oci-containers.containers.${cfg.name} = {
image = "ghcr.io/pocket-id/pocket-id:v2.14.0";
ports = [
@@ -38,9 +56,11 @@ in
systemd.services."${common.backend}-${cfg.name}" = {
serviceConfig = {
Restart = lib.mkOverride 90 "always";
ExecStartPost = ready;
};
wantedBy = [ "${common.backend}-${rootCfg.targetName}.target" ];
partOf = [ "${common.backend}-${rootCfg.targetName}.target" ];
before = [ "${common.backend}-${moduleCfg.targetName}.target" ];
wantedBy = [ "${common.backend}-${moduleCfg.targetName}.target" ];
partOf = [ "${common.backend}-${moduleCfg.targetName}.target" ];
preStart = ''
mkdir -p ${hostDataPath}/letsencrypt
chown -R ${common.user.uid}:${common.group.gid} ${hostDataPath}