fix(deploy): the .env migration called sed and grep by bare name on the activation PATH

NixOS activation scripts run with a minimal PATH that has coreutils but
not gnugrep or gnused. On sintra the snippet printed its success line and
then failed with "sed: command not found" (127) — the keys were never
renamed, the new app booted on fallback config, and switch-to-
configuration exited 2. Both binaries are now referenced by store path.
This commit is contained in:
Padreug 2026-10-10 22:08:48 +02:00
commit 9b07880925

View file

@ -488,8 +488,12 @@ in
system.activationScripts.bitspire-env-migration = {
deps = [ "users" ];
text = ''
if [ -f /var/lib/bitspire/.env ] && grep -q '^VITE_LAMASSU_' /var/lib/bitspire/.env; then
sed -i 's/^VITE_LAMASSU_/VITE_BITSPIRE_/' /var/lib/bitspire/.env
# Activation scripts run with a minimal PATH (coreutils, not gnugrep /
# gnused) — the first run of this snippet died with "sed: command not
# found" after printing success, so reference both by store path.
if [ -f /var/lib/bitspire/.env ] \
&& ${pkgs.gnugrep}/bin/grep -q '^VITE_LAMASSU_' /var/lib/bitspire/.env; then
${pkgs.gnused}/bin/sed -i 's/^VITE_LAMASSU_/VITE_BITSPIRE_/' /var/lib/bitspire/.env
echo "bitspire: migrated VITE_LAMASSU_* keys in /var/lib/bitspire/.env"
fi
'';