Skip to content

nixos-modules: escape % in HYDRA_DATABASE_URL - #1858

Merged
Ericson2314 merged 1 commit into
NixOS:masterfrom
obsidiansystems:fix-url-percent-systemd
Aug 13, 2026
Merged

nixos-modules: escape % in HYDRA_DATABASE_URL#1858
Ericson2314 merged 1 commit into
NixOS:masterfrom
obsidiansystems:fix-url-percent-systemd

Conversation

@Ericson2314

Copy link
Copy Markdown
Member

The default database URL reaches Postgres over a Unix socket, so its "host" is a percent-encoded directory: %2Frun%2Fpostgresql. systemd reads % in Environment= as the start of a specifier, fails to resolve %2, and drops the whole assignment:

Failed to resolve specifiers in HYDRA_DATABASE_URL=..., ignoring: Invalid slot

The services then fall back to postgres:///hydra, which carries no user, so libpq connects as the service's own Unix user — hydra-www, hydra-queue-runner — and peer auth rejects it, since the hydra-users ident map only maps those to the hydra role. The install test saw this as a 500 from the web UI.

Double the % on the copies bound for systemd; see the comment on dbUrlWithAppName. environment.variables is a plain shell environment and the queue runner reads its URL from TOML, so neither needs it.

Assisted-by: Claude Code (Opus 5)

The default database URL reaches Postgres over a Unix socket, so its
"host" is a percent-encoded directory: `%2Frun%2Fpostgresql`. systemd
reads `%` in `Environment=` as the start of a specifier, fails to resolve
`%2`, and drops the whole assignment:

    Failed to resolve specifiers in HYDRA_DATABASE_URL=..., ignoring: Invalid slot

The services then fall back to `postgres:///hydra`, which carries no
user, so libpq connects as the service's own Unix user — `hydra-www`,
`hydra-queue-runner` — and peer auth rejects it, since the `hydra-users`
ident map only maps those to the `hydra` role. The `install` test saw
this as a 500 from the web UI.

Double the `%` on the copies bound for systemd; see the comment on
`dbUrlWithAppName`. `environment.variables` is a plain shell environment
and the queue runner reads its URL from TOML, so neither needs it.

Assisted-by: Claude Code (Opus 5)
@Ericson2314
Ericson2314 enabled auto-merge August 13, 2026 23:25
@Ericson2314
Ericson2314 disabled auto-merge August 13, 2026 23:25
@Ericson2314
Ericson2314 added this pull request to the merge queue Aug 13, 2026
Merged via the queue into NixOS:master with commit 080343f Aug 13, 2026
2 checks passed
@Ericson2314
Ericson2314 deleted the fix-url-percent-systemd branch August 13, 2026 23:37
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant