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 - $UPLOAD_LOCATION:/data
- /etc/localtime:/etc/localtime:ro - /etc/localtime:/etc/localtime:ro
env_file: env_file:
- .env - /var/lib/numbus-server/immich/.env
depends_on: depends_on:
- immich-redis - immich-redis
- immich-database - immich-database
@@ -74,7 +74,7 @@ helper.mkPodmanService {
- ${cfg.configDir}/machine-learning-config:/usr/src/.config - ${cfg.configDir}/machine-learning-config:/usr/src/.config
- ${cfg.configDir}/machine-learning-cache:/usr/src/.cache/ - ${cfg.configDir}/machine-learning-cache:/usr/src/.cache/
env_file: env_file:
- .env - /var/lib/numbus-server/immich/.env
healthcheck: healthcheck:
disable: false disable: false
security_opt: security_opt:
+4 -6
View File
@@ -22,15 +22,13 @@ with lib;
dirPermissions ? [], dirPermissions ? [],
generatedSecrets ? {}, generatedSecrets ? {},
importedSecrets ? {}, importedSecrets ? {},
envFile ? null,
... ...
}: }:
let let
cfg = config.numbus.services.${name}; cfg = config.numbus.services.${name};
hasSecrets = (generatedSecrets != {}) || (importedSecrets != {}); hasSecrets = (generatedSecrets != {}) || (importedSecrets != {});
envFilePath = if envFile == null then "/var/lib/numbus-server/${name}/.env" else envFile; envFileArg = if hasSecrets != null then "/var/lib/numbus-server/${name}/.env" else "";
envFileArg = if hasSecrets || envFile != null then "--env-file ${envFilePath}" else "";
in in
{ {
@@ -112,7 +110,7 @@ ${concatStringsSep "\n" (map (m: " - ${m}") middlewares)}
TimeoutStartSec = "1000"; TimeoutStartSec = "1000";
ExecStartPre = [ ExecStartPre = [
"${pkgs.bash}/bin/bash -c 'sleep $((RANDOM % ${toString startDelay}))'" "${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"; 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"; 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) # Generated Secrets (only if missing)
${concatStringsSep "\n" (mapAttrsToList (k: v: '' ${concatStringsSep "\n" (mapAttrsToList (k: v: ''
if ! grep -q "^${k}=" "$SECRETS_FILE"; then if ! grep -q "^${k}=" "$SECRETS_FILE"; then
echo "${k}=$(${v})" >> "$SECRETS_FILE" echo "${k}=\"$(${v})\"" >> "$SECRETS_FILE"
fi fi
'') generatedSecrets)} '') generatedSecrets)}
@@ -186,7 +184,7 @@ ${concatStringsSep "\n" (map (m: " - ${m}") middlewares)}
grep -v "^${k}=" "$SECRETS_FILE" > "$SECRETS_FILE.tmp" grep -v "^${k}=" "$SECRETS_FILE" > "$SECRETS_FILE.tmp"
mv "$SECRETS_FILE.tmp" "$SECRETS_FILE" mv "$SECRETS_FILE.tmp" "$SECRETS_FILE"
fi fi
echo "${k}=${lib.escapeShellArg v}" >> "$SECRETS_FILE" echo "${k}=\"${lib.escapeShellArg v}\"" >> "$SECRETS_FILE"
'') importedSecrets)} '') importedSecrets)}
chown numbus-admin:users "$SECRETS_FILE" chown numbus-admin:users "$SECRETS_FILE"