about summary refs log tree commit diff
path: root/nixos/modules
diff options
context:
space:
mode:
authorMichal Sojka <michal.sojka@cvut.cz>2023-12-03 14:31:04 +0100
committergithub-actions[bot] <github-actions[bot]@users.noreply.github.com>2023-12-04 13:57:15 +0000
commit03c69641e0e2d799841fdc32767f872b684f493e (patch)
tree3ff786928d32bf9d8c47a3b5fa069b7fa1defbb2 /nixos/modules
parentb0866064dc0eb960566f3b31972efaef4f293112 (diff)
nixos/redmine: Fix database assertions
Recent PR 266270[1] modified an assertion related to database settings
of the redmine service. There are two problems with that change:

1. Assert message was not updated to reflect the change in the assert
   condition.

2. The new condition applies only to postgresql, not the default
   mysql. Therefore, the assertion breaks existing mysql-based
   installations without any reason.

This commit fixes these by 1) reverting the modified assertion to the
previous value, making the message match the condition and 2) adding a
new assertion that applies only to postgresql.

[1]: https://github.com/NixOS/nixpkgs/pull/266270

(cherry picked from commit 8667baf161e3f705f56c1bdd9cc48f187a3627a6)
Diffstat (limited to 'nixos/modules')
-rw-r--r--nixos/modules/services/misc/redmine.nix5
1 files changed, 4 insertions, 1 deletions
diff --git a/nixos/modules/services/misc/redmine.nix b/nixos/modules/services/misc/redmine.nix
index 20fa71507b6b0..6fe1ed5775796 100644
--- a/nixos/modules/services/misc/redmine.nix
+++ b/nixos/modules/services/misc/redmine.nix
@@ -267,9 +267,12 @@ in
       { assertion = cfg.database.passwordFile != null || cfg.database.socket != null;
         message = "one of services.redmine.database.socket or services.redmine.database.passwordFile must be set";
       }
-      { assertion = cfg.database.createLocally -> cfg.database.user == cfg.user && cfg.database.user == cfg.database.name;
+      { assertion = cfg.database.createLocally -> cfg.database.user == cfg.user;
         message = "services.redmine.database.user must be set to ${cfg.user} if services.redmine.database.createLocally is set true";
       }
+      { assertion = pgsqlLocal -> cfg.database.user == cfg.database.name;
+        message = "services.redmine.database.user and services.redmine.database.name must be the same when using a local postgresql database";
+      }
       { assertion = cfg.database.createLocally -> cfg.database.socket != null;
         message = "services.redmine.database.socket must be set if services.redmine.database.createLocally is set to true";
       }