summaryrefslogtreecommitdiffstats
path: root/nixos/modules/services/misc
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/misc
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/misc')
-rw-r--r--nixos/modules/services/misc/forgejo.nix4
-rw-r--r--nixos/modules/services/misc/gitea.nix4
2 files changed, 4 insertions, 4 deletions
diff --git a/nixos/modules/services/misc/forgejo.nix b/nixos/modules/services/misc/forgejo.nix
index 08cddc3a0710..2b1700626870 100644
--- a/nixos/modules/services/misc/forgejo.nix
+++ b/nixos/modules/services/misc/forgejo.nix
@@ -114,11 +114,11 @@ in
port = mkOption {
type = types.port;
- default = if !usePostgresql then 3306 else pg.port;
+ default = if usePostgresql then pg.settings.port else 3306;
defaultText = literalExpression ''
if config.${opt.database.type} != "postgresql"
then 3306
- else config.${options.services.postgresql.port}
+ else 5432
'';
description = mdDoc "Database host port.";
};
diff --git a/nixos/modules/services/misc/gitea.nix b/nixos/modules/services/misc/gitea.nix
index 08feea853e47..13617931c23e 100644
--- a/nixos/modules/services/misc/gitea.nix
+++ b/nixos/modules/services/misc/gitea.nix
@@ -100,11 +100,11 @@ in
port = mkOption {
type = types.port;
- default = if !usePostgresql then 3306 else pg.port;
+ default = if usePostgresql then pg.settings.port else 3306;
defaultText = literalExpression ''
if config.${opt.database.type} != "postgresql"
then 3306
- else config.${options.services.postgresql.port}
+ else 5432
'';
description = lib.mdDoc "Database host port.";
};