about summary refs log tree commit diff
path: root/nixos/modules/services
diff options
context:
space:
mode:
authorJamey Sharp <jamey@minilop.net>2019-07-06 09:29:58 -0700
committerNikolay Amiantov <ab@fmap.me>2019-07-17 11:08:10 +0300
commitd4e5748c1b919718e51cb03d6958cf06ce5d5308 (patch)
tree28fa53be4fe35e84800b84481eff2549079e29f0 /nixos/modules/services
parent294751a4fc38b7af013d2d1e92f20ed332576850 (diff)
downloadnixlib-d4e5748c1b919718e51cb03d6958cf06ce5d5308.tar
nixlib-d4e5748c1b919718e51cb03d6958cf06ce5d5308.tar.gz
nixlib-d4e5748c1b919718e51cb03d6958cf06ce5d5308.tar.bz2
nixlib-d4e5748c1b919718e51cb03d6958cf06ce5d5308.tar.lz
nixlib-d4e5748c1b919718e51cb03d6958cf06ce5d5308.tar.xz
nixlib-d4e5748c1b919718e51cb03d6958cf06ce5d5308.tar.zst
nixlib-d4e5748c1b919718e51cb03d6958cf06ce5d5308.zip
nixos/openldap: fix assertion
In commit d43dc68db3f414a527cad632a3f1fb868fc1c902, @Mic92 split the
rootpw option to allow specifying it in a file kept outside the Nix
store, as an alternative to specifying the password directly in the
config.

Prior to that, rootpw's type was `str`, but in order to allow both
alternatives, it had to become `nullOr str` with a default of `null`. So
I can see why this assertion, that either rootpw or rootpwFile are
specified, makes sense to add here.

However, these options aren't used if the configDir option is set, so as
written this assertion breaks valid configurations, including the
configuration used by nixos/tests/ldap.nix.

So this patch fixes the assertion so that it doesn't fire if configDir
is set.
Diffstat (limited to 'nixos/modules/services')
-rw-r--r--nixos/modules/services/databases/openldap.nix4
1 files changed, 2 insertions, 2 deletions
diff --git a/nixos/modules/services/databases/openldap.nix b/nixos/modules/services/databases/openldap.nix
index c2f458c03794..d8e2c715afb9 100644
--- a/nixos/modules/services/databases/openldap.nix
+++ b/nixos/modules/services/databases/openldap.nix
@@ -237,8 +237,8 @@ in
   config = mkIf cfg.enable {
     assertions = [
       {
-        assertion = cfg.rootpwFile != null || cfg.rootpw != null;
-        message = "Either services.openldap.rootpw or services.openldap.rootpwFile must be set";
+        assertion = cfg.configDir != null || cfg.rootpwFile != null || cfg.rootpw != null;
+        message = "services.openldap: Unless configDir is set, either rootpw or rootpwFile must be set";
       }
     ];