summary refs log tree commit diff
path: root/nixos/modules/services/web-apps/mobilizon.nix
diff options
context:
space:
mode:
authorRyan Lahfa <masterancpp@gmail.com>2023-11-17 18:02:17 +0100
committerGitHub <noreply@github.com>2023-11-17 18:02:17 +0100
commitccfe07c3168109567b98462533f7ddf14c7ba18d (patch)
tree5519b30e969dfbacf48caa51505b3eb49213b290 /nixos/modules/services/web-apps/mobilizon.nix
parentbea932e00a092efe7be61f7bcbebf4a18241a07b (diff)
parent82037ad0b89db3d392c49c1fdbc6b325da5586b1 (diff)
downloadnixpkgs-ccfe07c3168109567b98462533f7ddf14c7ba18d.tar
nixpkgs-ccfe07c3168109567b98462533f7ddf14c7ba18d.tar.gz
nixpkgs-ccfe07c3168109567b98462533f7ddf14c7ba18d.tar.bz2
nixpkgs-ccfe07c3168109567b98462533f7ddf14c7ba18d.tar.lz
nixpkgs-ccfe07c3168109567b98462533f7ddf14c7ba18d.tar.xz
nixpkgs-ccfe07c3168109567b98462533f7ddf14c7ba18d.tar.zst
nixpkgs-ccfe07c3168109567b98462533f7ddf14c7ba18d.zip
Merge pull request #266270 from Ma27/postgresql-ownership-15
Diffstat (limited to 'nixos/modules/services/web-apps/mobilizon.nix')
-rw-r--r--nixos/modules/services/web-apps/mobilizon.nix13
1 files changed, 10 insertions, 3 deletions
diff --git a/nixos/modules/services/web-apps/mobilizon.nix b/nixos/modules/services/web-apps/mobilizon.nix
index 343c5cead2b..bb4319b51a2 100644
--- a/nixos/modules/services/web-apps/mobilizon.nix
+++ b/nixos/modules/services/web-apps/mobilizon.nix
@@ -347,12 +347,18 @@ in
 
       # Taken from here:
       # https://framagit.org/framasoft/mobilizon/-/blob/1.1.0/priv/templates/setup_db.eex
+      # TODO(to maintainers of mobilizon): the owner database alteration is necessary
+      # as PostgreSQL 15 changed their behaviors w.r.t. to privileges.
+      # See https://github.com/NixOS/nixpkgs/issues/216989 to get rid
+      # of that workaround.
       script =
         ''
           psql "${repoSettings.database}" -c "\
             CREATE EXTENSION IF NOT EXISTS postgis; \
             CREATE EXTENSION IF NOT EXISTS pg_trgm; \
             CREATE EXTENSION IF NOT EXISTS unaccent;"
+          psql -tAc 'ALTER DATABASE "${repoSettings.database}" OWNER TO "${dbUser}";'
+
         '';
 
       serviceConfig = {
@@ -372,9 +378,10 @@ in
       ensureUsers = [
         {
           name = dbUser;
-          ensurePermissions = {
-            "DATABASE \"${repoSettings.database}\"" = "ALL PRIVILEGES";
-          };
+          # Given that `dbUser` is potentially arbitrarily custom, we will perform
+          # manual fixups in mobilizon-postgres.
+          # TODO(to maintainers of mobilizon): Feel free to simplify your setup by using `ensureDBOwnership`.
+          ensureDBOwnership = false;
         }
       ];
       extraPlugins = with postgresql.pkgs; [ postgis ];