This commit is contained in:
2026-02-19 19:44:28 +02:00
parent d746237393
commit 1c56b0c1e5

View File

@@ -374,13 +374,26 @@ in
RemainAfterExit = true;
};
script = ''
set -euo pipefail
if [ ! -d "${cfg.source}" ]; then
echo "wafrn-nix: source directory does not exist: ${cfg.source}" >&2
exit 1
fi
if [ ! -f "${cfg.source}/package-lock.json" ]; then
echo "wafrn-nix: package-lock.json missing, generating with npm" >&2
(cd "${cfg.source}" && npm install --package-lock-only --ignore-scripts)
if ! (cd "${cfg.source}" && npm install --package-lock-only --ignore-scripts); then
echo "wafrn-nix: failed to generate package-lock.json, continuing with existing source" >&2
fi
fi
install -m 0600 ${envTemplate} ${serviceEnvFile}
${optionalString (cfg.secretsFile != null) ''
if [ ! -f "${cfg.secretsFile}" ]; then
echo "wafrn-nix: secretsFile does not exist: ${cfg.secretsFile}" >&2
exit 1
fi
cat "${cfg.secretsFile}" >> ${serviceEnvFile}
''}
install -m 0644 ${composeTemplate} ${composeFile}