summary refs log tree commit diff
path: root/nixos/modules/services/databases
diff options
context:
space:
mode:
authorJörg Thalheim <joerg@thalheim.io>2020-01-12 13:40:08 +0000
committerJörg Thalheim <joerg@thalheim.io>2020-01-12 14:25:49 +0000
commit382b0aa52dfd843779bdae73a86438807ea1a2dc (patch)
treec7abd369e9840a1b8750883f563d04ece99427e3 /nixos/modules/services/databases
parent9884cb3ed004984696a64915849afe175ac5c597 (diff)
downloadnixpkgs-382b0aa52dfd843779bdae73a86438807ea1a2dc.tar
nixpkgs-382b0aa52dfd843779bdae73a86438807ea1a2dc.tar.gz
nixpkgs-382b0aa52dfd843779bdae73a86438807ea1a2dc.tar.bz2
nixpkgs-382b0aa52dfd843779bdae73a86438807ea1a2dc.tar.lz
nixpkgs-382b0aa52dfd843779bdae73a86438807ea1a2dc.tar.xz
nixpkgs-382b0aa52dfd843779bdae73a86438807ea1a2dc.tar.zst
nixpkgs-382b0aa52dfd843779bdae73a86438807ea1a2dc.zip
nixos/openldap: check configuration with slaptest
slapd does only print the error and not the line number.
Sometimes it is not even clear that it fails to start
due to an incorrect configuration file.

Example output of slaptest:

5e1b2179 /nix/store/gbn2v319d4qgw851sg41mcmjm5dpn39i-slapd.conf: line 134 objectClass: Missing closing parenthesis before end of input
ObjectClassDescription = "(" whsp
  numericoid whsp                 ; ObjectClass identifier
  [ "NAME" qdescrs ]
  [ "DESC" qdstring ]
  [ "OBSOLETE" whsp ]
  [ "SUP" oids ]                ; Superior ObjectClasses
  [ ( "ABSTRACT" / "STRUCTURAL" / "AUXILIARY" ) whsp ]
                                  ; default structural
  [ "MUST" oids ]               ; AttributeTypes
  [ "MAY" oids ]                ; AttributeTypes
  whsp ")"
slaptest: bad configuration file!
Diffstat (limited to 'nixos/modules/services/databases')
-rw-r--r--nixos/modules/services/databases/openldap.nix2
1 files changed, 2 insertions, 0 deletions
diff --git a/nixos/modules/services/databases/openldap.nix b/nixos/modules/services/databases/openldap.nix
index 5bf57a1bf9c..809f61cfa81 100644
--- a/nixos/modules/services/databases/openldap.nix
+++ b/nixos/modules/services/databases/openldap.nix
@@ -259,6 +259,8 @@ in
           ${openldap.out}/bin/slapadd ${configOpts} -l ${dataFile}
         ''}
         chown -R "${cfg.user}:${cfg.group}" "${cfg.dataDir}"
+
+        ${openldap}/bin/slaptest ${configOpts}
       '';
       serviceConfig.ExecStart =
         "${openldap.out}/libexec/slapd -d '${cfg.logLevel}' " +