fix(attic): specify PostgreSQL database for postStart script

- Update `psql` command in the `postStart` script to explicitly connect to the `postgres` database before altering ownership of the `attic` database.
- Ensures the command runs without issues in environments with restricted default database access.
This commit is contained in:
Harald Hoyer 2026-03-25 10:31:51 +01:00
parent e12fc523d6
commit 77a8e0ffcc

View file

@ -8,11 +8,11 @@
services.postgresql = { services.postgresql = {
enable = true; enable = true;
ensureDatabases = [ "attic" ]; ensureDatabases = [ "attic" ];
ensureUsers = [ { name = "atticd"; } ]; ensureUsers = [{ name = "atticd"; }];
}; };
systemd.services.postgresql.postStart = lib.mkAfter '' systemd.services.postgresql.postStart = lib.mkAfter ''
psql -tAc 'ALTER DATABASE "attic" OWNER TO "atticd"' psql -d postgres -tAc 'ALTER DATABASE "attic" OWNER TO "atticd"'
''; '';
environment.systemPackages = with pkgs; [ attic-client ]; environment.systemPackages = with pkgs; [ attic-client ];