about summary refs log tree commit diff
path: root/nixos
diff options
context:
space:
mode:
authorMichal Sojka <michal.sojka@cvut.cz>2023-12-03 14:31:04 +0100
committerMichal Sojka <michal.sojka@cvut.cz>2023-12-03 14:41:42 +0100
commit8667baf161e3f705f56c1bdd9cc48f187a3627a6 (patch)
tree1d5722b4cd2c045d04c0d91481fb3522bd449079 /nixos
parente92039b55bcd58469325ded85d4f58dd5a4eaf58 (diff)
downloadnixlib-8667baf161e3f705f56c1bdd9cc48f187a3627a6.tar
nixlib-8667baf161e3f705f56c1bdd9cc48f187a3627a6.tar.gz
nixlib-8667baf161e3f705f56c1bdd9cc48f187a3627a6.tar.bz2
nixlib-8667baf161e3f705f56c1bdd9cc48f187a3627a6.tar.lz
nixlib-8667baf161e3f705f56c1bdd9cc48f187a3627a6.tar.xz
nixlib-8667baf161e3f705f56c1bdd9cc48f187a3627a6.tar.zst
nixlib-8667baf161e3f705f56c1bdd9cc48f187a3627a6.zip
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
Diffstat (limited to 'nixos')
-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 20fa71507b6b..6fe1ed577579 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";
       }