Merge pull request #262741 from emilylange/nixos-forgejo-postgres15
nixos/forgejo: work around permissions error on `postgresql_15`
This commit is contained in:
commit
a61c6b478d
1 changed files with 11 additions and 0 deletions
|
@ -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;
|
||||
|
|
Loading…
Reference in a new issue