-
-
Notifications
You must be signed in to change notification settings - Fork 195
Closed
Description
Problem
There are various cases where bash scripts are source from within Nix and then they have their variables replaced with substitute
:
-
Lines 498 to 510 in 61ff753
pkgs.runCommand "start-postgres-client" { } '' mkdir -p $out/bin substitute ${./nix/tools/run-client.sh.in} $out/bin/start-postgres-client \ --subst-var-by 'PGSQL_DEFAULT_PORT' '${pgsqlDefaultPort}' \ --subst-var-by 'PGSQL_SUPERUSER' '${pgsqlSuperuser}' \ --subst-var-by 'PSQL15_BINDIR' '${basePackages.psql_15.bin}' \ --subst-var-by 'PSQL17_BINDIR' '${basePackages.psql_17.bin}' \ --subst-var-by 'PSQLORIOLEDB17_BINDIR' '${basePackages.psql_orioledb-17.bin}' \ --subst-var-by 'MIGRATIONS_DIR' '${migrationsDir}' \ --subst-var-by 'POSTGRESQL_SCHEMA_SQL' '${postgresqlSchemaSql}' \ --subst-var-by 'PGBOUNCER_AUTH_SCHEMA_SQL' '${pgbouncerAuthSchemaSql}' \ --subst-var-by 'STAT_EXTENSION_SQL' '${statExtensionSql}' chmod +x $out/bin/start-postgres-client -
Lines 523 to 528 in 61ff753
substitute ${./nix/tools/migrate-tool.sh.in} $out/bin/migrate-postgres \ --subst-var-by 'PSQL15_BINDIR' '${basePackages.psql_15.bin}' \ --subst-var-by 'PSQL_CONF_FILE' '${configFile}' \ --subst-var-by 'PGSODIUM_GETKEY' '${getkeyScript}' \ --subst-var-by 'PRIMING_SCRIPT' '${primingScript}' \ --subst-var-by 'MIGRATION_DATA' '${migrationData}' -
Lines 535 to 537 in 61ff753
substitute ${./nix/tools/run-replica.sh.in} $out/bin/start-postgres-replica \ --subst-var-by 'PGSQL_SUPERUSER' '${pgsqlSuperuser}' \ --subst-var-by 'PSQL15_BINDIR' '${basePackages.psql_15.bin}'
This hurts reusability of the scripts logic and adds verboseness to the scripts.
Solution
Inline the scripts in the Nix file to avoid substitutions.
samrose
Metadata
Metadata
Assignees
Labels
No labels