git.iko.soy/typeable/nixpkgs
on master help sign in
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.

commitd4e5748c1b919718e51cb03d6958cf06ce5d5308 authorJamey Sharp <jamey@minilop.net> dateSat 6 Jul 2019, 09:29 (7 years ago) parent294751a
1 file changed+2−2
nixos/modules/services/databases/openldap.nix+2−2
nixos/modules/services/databases/openldap.nix+2−2
@@ -237,8 +237,8 @@ in
237237 config = mkIf cfg.enable {
238238 assertions = [
239239 {
240− assertion = cfg.rootpwFile != null || cfg.rootpw != null;
241− message = "Either services.openldap.rootpw or services.openldap.rootpwFile must be set";
240+ assertion = cfg.configDir != null || cfg.rootpwFile != null || cfg.rootpw != null;
241+ message = "services.openldap: Unless configDir is set, either rootpw or rootpwFile must be set";
242242 }
243243 ];
244244