diff options
author | Léo Gaspard <leo@gaspard.io> | 2018-03-03 15:33:01 +0100 |
---|---|---|
committer | Léo Gaspard <leo@gaspard.io> | 2018-03-03 15:33:01 +0100 |
commit | cca9ec2a6649c48dc308b0879728c6e108bd40f1 (patch) | |
tree | df3af55f4c58a16b2e4a861d4424530e5ffe2c44 /nixos | |
parent | 831ef4756e372bfff77332713ae319daa3a42742 (diff) |
openldap module: cleanup
Diffstat (limited to 'nixos')
-rw-r--r-- | nixos/modules/services/databases/openldap.nix | 17 |
1 files changed, 11 insertions, 6 deletions
diff --git a/nixos/modules/services/databases/openldap.nix b/nixos/modules/services/databases/openldap.nix index e884098cb08d0..9c6b33a16bf11 100644 --- a/nixos/modules/services/databases/openldap.nix +++ b/nixos/modules/services/databases/openldap.nix @@ -8,7 +8,8 @@ let openldap = pkgs.openldap; configFile = pkgs.writeText "slapd.conf" cfg.extraConfig; - + configOpts = if cfg.configDir == null then "-f ${configFile}" + else "-F ${cfg.configDir}"; in { @@ -88,7 +89,7 @@ in ###### implementation - config = mkIf config.services.openldap.enable { + config = mkIf cfg.enable { environment.systemPackages = [ openldap ]; @@ -98,11 +99,15 @@ in after = [ "network.target" ]; preStart = '' mkdir -p /var/run/slapd - chown -R ${cfg.user}:${cfg.group} /var/run/slapd - mkdir -p ${cfg.dataDir} - chown -R ${cfg.user}:${cfg.group} ${cfg.dataDir} + chown -R "${cfg.user}:${cfg.group}" /var/run/slapd + mkdir -p "${cfg.dataDir}" + chown -R "${cfg.user}:${cfg.group}" "${cfg.dataDir}" ''; - serviceConfig.ExecStart = "${openldap.out}/libexec/slapd -u ${cfg.user} -g ${cfg.group} -d 0 -h \"${concatStringsSep " " cfg.urlList}\" ${if cfg.configDir == null then "-f "+configFile else "-F "+cfg.configDir}"; + serviceConfig.ExecStart = + "${openldap.out}/libexec/slapd -d 0 " + + "-u '${cfg.user}' -g '${cfg.group}' " + + "-h '${concatStringsSep " " cfg.urlList}' " + + "${configOpts}"; }; users.extraUsers.openldap = |