Skip to content

Commit

Permalink
Merge pull request #262741 from emilylange/nixos-forgejo-postgres15
Browse files Browse the repository at this point in the history
nixos/forgejo: work around permissions error on `postgresql_15`
  • Loading branch information
emilylange committed Oct 22, 2023
2 parents 5c00419 + b8585a1 commit a61c6b4
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions nixos/modules/services/misc/forgejo.nix
Original file line number Diff line number Diff line change
Expand Up @@ -428,6 +428,17 @@ in
];
};

# Work around 'pq: permission denied for schema public' with postgres v15, until a
# solution for `services.postgresql.ensureUsers` is found.
# See https://github.com/NixOS/nixpkgs/issues/216989
systemd.services.postgresql.postStart = lib.mkIf (
usePostgresql
&& cfg.database.createDatabase
&& lib.strings.versionAtLeast config.services.postgresql.package.version "15.0"
) (lib.mkAfter ''
$PSQL -tAc 'ALTER DATABASE "${cfg.database.name}" OWNER TO "${cfg.database.user}";'
'');

services.mysql = optionalAttrs (useMysql && cfg.database.createDatabase) {
enable = mkDefault true;
package = mkDefault pkgs.mariadb;
Expand Down

0 comments on commit a61c6b4

Please sign in to comment.