diff --git a/docs/CHANGELOG.md b/docs/CHANGELOG.md index f8068325..35600f03 100644 --- a/docs/CHANGELOG.md +++ b/docs/CHANGELOG.md @@ -1,5 +1,10 @@ # Changelog +## 2026-10-25: fix pgweb/mathesar postgresql.target dependency and refresh all DB collations + +- **pgweb & mathesar**: Added `requires = [ "postgresql.target" ];` to `systemd.services.pgweb` (`platforms/nixos/modules/nmasur/presets/services/pgweb.nix`) and `"postgresql.target"` to `systemd.services.mathesar.requires` (`platforms/nixos/modules/nmasur/presets/services/mathesar/mathesar.nix`). Previously they only set `after = [ "postgresql.target" ]`, allowing `switch-to-configuration` to start `pgweb.service` before `postgresql.target` was queued and causing `pgweb` to fail with `connect: no such file or directory` on `/run/postgresql/.s.PGSQL.5432`. +- **PostgreSQL collation version refresh**: Updated `systemd.services.postgresql-setup.preStart` (`platforms/nixos/modules/nmasur/presets/services/postgresql.nix`) to iterate over all databases with `datallowconn` in `pg_database` and run `ALTER DATABASE ... REFRESH COLLATION VERSION;` instead of only refreshing `template1` and `postgres`. + ## 2026-10-24: fix build failures for NixOS swan - **Nextcloud**: Upstream NixOS removed `services.nextcloud.config.adminpassFile` and `services.nextcloud.config.adminuser`. Removed `adminpassFile` from `services.nextcloud.config`, updated `services.prometheus.exporters.nextcloud` to reference `config.secrets.nextcloud.dest` directly as `passwordFile` and set `username = "root"`, and added ordering dependencies on `nextcloud-secret` for `prometheus-nextcloud-exporter.service`. diff --git a/platforms/nixos/modules/nmasur/presets/services/mathesar/mathesar.nix b/platforms/nixos/modules/nmasur/presets/services/mathesar/mathesar.nix index a85399a6..6913b37c 100644 --- a/platforms/nixos/modules/nmasur/presets/services/mathesar/mathesar.nix +++ b/platforms/nixos/modules/nmasur/presets/services/mathesar/mathesar.nix @@ -30,6 +30,7 @@ in "postgresql.target" ]; requires = [ + "postgresql.target" "mathesar-secret.service" "mathesar-postgres-secret.service" ]; diff --git a/platforms/nixos/modules/nmasur/presets/services/pgweb.nix b/platforms/nixos/modules/nmasur/presets/services/pgweb.nix index b1c19ce9..586d1117 100644 --- a/platforms/nixos/modules/nmasur/presets/services/pgweb.nix +++ b/platforms/nixos/modules/nmasur/presets/services/pgweb.nix @@ -28,6 +28,9 @@ in after = [ "postgresql.target" ]; + requires = [ + "postgresql.target" + ]; # requires = [ "pgweb-secret.service" ]; wantedBy = [ "multi-user.target" ]; serviceConfig = { diff --git a/platforms/nixos/modules/nmasur/presets/services/postgresql.nix b/platforms/nixos/modules/nmasur/presets/services/postgresql.nix index b2a00bd1..81a41e3a 100644 --- a/platforms/nixos/modules/nmasur/presets/services/postgresql.nix +++ b/platforms/nixos/modules/nmasur/presets/services/postgresql.nix @@ -45,8 +45,9 @@ in if ! systemctl is-active --quiet postgresql.service; then break; fi sleep 0.1 done - ${config.services.postgresql.package}/bin/psql -d postgres -tAc 'ALTER DATABASE template1 REFRESH COLLATION VERSION;' || true - ${config.services.postgresql.package}/bin/psql -d postgres -tAc 'ALTER DATABASE postgres REFRESH COLLATION VERSION;' || true + for db in $(${config.services.postgresql.package}/bin/psql -d postgres -tAc 'SELECT datname FROM pg_database WHERE datallowconn;'); do + ${config.services.postgresql.package}/bin/psql -d postgres -tAc "ALTER DATABASE \"$db\" REFRESH COLLATION VERSION;" || true + done ''; }; };