Skip to content

Commit

Permalink
fix postgresql tests
Browse files Browse the repository at this point in the history
Since postgresql sets ProtectSystem=strict, all directories must exist
before the service is started. Also all directories where write access
is needed must be specified.

PL-133170
  • Loading branch information
Philipp Neumann committed Nov 17, 2024
1 parent 0202611 commit 5ebb829
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion nixos/services/postgresql/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -167,6 +167,7 @@ in {

systemd.services.postgresql.serviceConfig = {
Restart = "always";
ReadWritePaths = [ "/nix/var/nix/gcroots/per-user/postgres" ];
} // lib.optionalAttrs (lib.versionAtLeast cfg.majorVersion "12") {
RuntimeDirectory = "postgresql";
};
Expand Down Expand Up @@ -211,7 +212,7 @@ in {

flyingcircus.activationScripts = {
postgresql-srv = lib.stringAfter [ "users" "groups" ] ''
install -d -o postgres /srv/postgresql
install -d -o postgres /srv/postgresql/${cfg.majorVersion}
install -d -o postgres /nix/var/nix/gcroots/per-user/postgres
'';
};
Expand Down

0 comments on commit 5ebb829

Please sign in to comment.