Removed unnecessary code. Fixed immich env not found. Fixed nextcloud-quirks by quoting .env variable values.

This commit is contained in:
Raphaël Numbus
2026-02-26 18:07:57 +01:00
parent b68deed2e7
commit 16c1517d95
2 changed files with 6 additions and 8 deletions
+2 -2
View File
@@ -51,7 +51,7 @@ helper.mkPodmanService {
- $UPLOAD_LOCATION:/data
- /etc/localtime:/etc/localtime:ro
env_file:
- .env
- /var/lib/numbus-server/immich/.env
depends_on:
- immich-redis
- immich-database
@@ -74,7 +74,7 @@ helper.mkPodmanService {
- ${cfg.configDir}/machine-learning-config:/usr/src/.config
- ${cfg.configDir}/machine-learning-cache:/usr/src/.cache/
env_file:
- .env
- /var/lib/numbus-server/immich/.env
healthcheck:
disable: false
security_opt:
+4 -6
View File
@@ -22,15 +22,13 @@ with lib;
dirPermissions ? [],
generatedSecrets ? {},
importedSecrets ? {},
envFile ? null,
...
}:
let
cfg = config.numbus.services.${name};
hasSecrets = (generatedSecrets != {}) || (importedSecrets != {});
envFilePath = if envFile == null then "/var/lib/numbus-server/${name}/.env" else envFile;
envFileArg = if hasSecrets || envFile != null then "--env-file ${envFilePath}" else "";
envFileArg = if hasSecrets != null then "/var/lib/numbus-server/${name}/.env" else "";
in
{
@@ -112,7 +110,7 @@ ${concatStringsSep "\n" (map (m: " - ${m}") middlewares)}
TimeoutStartSec = "1000";
ExecStartPre = [
"${pkgs.bash}/bin/bash -c 'sleep $((RANDOM % ${toString startDelay}))'"
"${pkgs.sudo}/bin/sudo -u numbus-admin podman-compose ${envFileArg} -f /etc/podman/${name}/compose.yaml pull"
"${pkgs.sudo}/bin/sudo -u numbus-admin podman-compose -f /etc/podman/${name}/compose.yaml pull"
];
ExecStart = "${pkgs.sudo}/bin/sudo -u numbus-admin podman-compose ${envFileArg} --in-pod ${toString pod} -f /etc/podman/${name}/compose.yaml up --remove-orphans";
ExecStop = "${pkgs.sudo}/bin/sudo -u numbus-admin podman-compose ${envFileArg} --in-pod ${toString pod} -f /etc/podman/${name}/compose.yaml down";
@@ -176,7 +174,7 @@ ${concatStringsSep "\n" (map (m: " - ${m}") middlewares)}
# Generated Secrets (only if missing)
${concatStringsSep "\n" (mapAttrsToList (k: v: ''
if ! grep -q "^${k}=" "$SECRETS_FILE"; then
echo "${k}=$(${v})" >> "$SECRETS_FILE"
echo "${k}=\"$(${v})\"" >> "$SECRETS_FILE"
fi
'') generatedSecrets)}
@@ -186,7 +184,7 @@ ${concatStringsSep "\n" (map (m: " - ${m}") middlewares)}
grep -v "^${k}=" "$SECRETS_FILE" > "$SECRETS_FILE.tmp"
mv "$SECRETS_FILE.tmp" "$SECRETS_FILE"
fi
echo "${k}=${lib.escapeShellArg v}" >> "$SECRETS_FILE"
echo "${k}=\"${lib.escapeShellArg v}\"" >> "$SECRETS_FILE"
'') importedSecrets)}
chown numbus-admin:users "$SECRETS_FILE"