diff options
author | Christoph Heiss <christoph@c8h4.io> | 2023-11-11 15:50:16 +0100 |
---|---|---|
committer | Christoph Heiss <christoph@c8h4.io> | 2023-11-11 15:50:16 +0100 |
commit | 88a3d2a0b43e80f9275af1952a9b94b6ddcd88af (patch) | |
tree | 78856e4a011854b605cf8f24594dcb7937b96d8d /nixos | |
parent | 66b86f8a2e665832a431d7a69c6ab806c74eec88 (diff) |
sourcehut: fix postgresql database permission for postgresql >= 15
Signed-off-by: Christoph Heiss <christoph@c8h4.io>
Diffstat (limited to 'nixos')
-rw-r--r-- | nixos/modules/services/misc/sourcehut/service.nix | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/nixos/modules/services/misc/sourcehut/service.nix b/nixos/modules/services/misc/sourcehut/service.nix index 101389c4d942..18c2f5effc5a 100644 --- a/nixos/modules/services/misc/sourcehut/service.nix +++ b/nixos/modules/services/misc/sourcehut/service.nix @@ -377,6 +377,20 @@ in } extraService ])) extraServices) + + # 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 + # Workaround taken from nixos/forgejo: https://github.com/NixOS/nixpkgs/pull/262741 + (lib.mkIf ( + cfg.postgresql.enable + && lib.strings.versionAtLeast config.services.postgresql.package.version "15.0" + ) { + postgresql.postStart = (lib.mkAfter '' + $PSQL -tAc 'ALTER DATABASE "${srvCfg.postgresql.database}" OWNER TO "${srvCfg.user}";' + ''); + } + ) ]; systemd.timers = mapAttrs (timerName: timer: |