about summary refs log tree commit diff
path: root/nixos/modules/services/databases/postgresql.md
diff options
context:
space:
mode:
authorMaximilian Bosch <maximilian@mbosch.me>2024-03-17 11:54:30 +0100
committerMaximilian Bosch <maximilian@mbosch.me>2024-03-30 14:23:05 +0100
commit5142b7afa88db6ccec229521ad96df4419f6abe4 (patch)
treebc2022b956505c4fb862c6d753ae4503efe7c3cf /nixos/modules/services/databases/postgresql.md
parent8b152a2242d4f29de1c072f833ab941dd141c510 (diff)
nixos/postgresql: turn `settings` into a submodule
The main idea behind that was to be able to do more sophisticated
merging for stuff that goes into `postgresql.conf`:
`shared_preload_libraries` is a comma-separated list in a `types.str`
and thus not mergeable. With this change, the option accepts both a
comma-separated string xor a list of strings.

This can be implemented rather quick using `coercedTo` +
freeform modules. The interface still behaves equally, but it allows to
merge declarations for this option together.

One side-effect was that I had to change the `attrsOf (oneOf ...)` part into
a submodule to allow declaring options for certain things. While at it,
I decided to move `log_line_prefix` and `port` into this structure as
well.
Diffstat (limited to 'nixos/modules/services/databases/postgresql.md')
-rw-r--r--nixos/modules/services/databases/postgresql.md6
1 files changed, 3 insertions, 3 deletions
diff --git a/nixos/modules/services/databases/postgresql.md b/nixos/modules/services/databases/postgresql.md
index 6cce8f542a532..8a587832cd8c0 100644
--- a/nixos/modules/services/databases/postgresql.md
+++ b/nixos/modules/services/databases/postgresql.md
@@ -118,7 +118,7 @@ are already created.
       before = "service1.service";
       after = "postgresql.service";
       serviceConfig.User = "postgres";
-      environment.PSQL = "psql --port=${toString services.postgresql.port}";
+      environment.PSQL = "psql --port=${toString services.postgresql.settings.port}";
       path = [ postgresql ];
       script = ''
         $PSQL service1 -c 'GRANT SELECT ON ALL TABLES IN SCHEMA public TO "extraUser1"'
@@ -139,7 +139,7 @@ are already created.
 
 ```nix
   {
-    environment.PSQL = "psql --port=${toString services.postgresql.port}";
+    environment.PSQL = "psql --port=${toString services.postgresql.settings.port}";
     path = [ postgresql ];
     systemd.services."service1".preStart = ''
       $PSQL -c 'GRANT SELECT ON ALL TABLES IN SCHEMA public TO "extraUser1"'
@@ -159,7 +159,7 @@ are already created.
       before = "service1.service";
       after = "postgresql.service";
       serviceConfig.User = "service1";
-      environment.PSQL = "psql --port=${toString services.postgresql.port}";
+      environment.PSQL = "psql --port=${toString services.postgresql.settings.port}";
       path = [ postgresql ];
       script = ''
         $PSQL -c 'GRANT SELECT ON ALL TABLES IN SCHEMA public TO "extraUser1"'