mirror of
https://github.com/NixOS/nixpkgs.git
synced 2024-12-22 05:33:23 +00:00
eb6e1310b8
svn path=/nixos/trunk/; revision=29285
63 lines
940 B
Nix
63 lines
940 B
Nix
{ config, pkgs, ... }:
|
|
|
|
with pkgs.lib;
|
|
|
|
let
|
|
|
|
cfg = config.services.openldap;
|
|
openldap = pkgs.openldap;
|
|
|
|
configFile = pkgs.writeText "slapd.conf" cfg.extraConfig;
|
|
|
|
in
|
|
|
|
{
|
|
|
|
###### interface
|
|
|
|
options = {
|
|
|
|
services.openldap = {
|
|
|
|
enable = mkOption {
|
|
default = false;
|
|
description = "
|
|
Whether to enable the ldap server.
|
|
";
|
|
};
|
|
|
|
extraConfig = mkOption {
|
|
default = "";
|
|
description = "
|
|
sldapd.conf configuration
|
|
";
|
|
};
|
|
};
|
|
|
|
};
|
|
|
|
|
|
###### implementation
|
|
|
|
config = mkIf config.services.openldap.enable {
|
|
|
|
environment.systemPackages = [ openldap ];
|
|
|
|
jobs.openldap =
|
|
{
|
|
description = "LDAP server";
|
|
|
|
startOn = "filesystem";
|
|
daemonType = "fork";
|
|
|
|
preStart =
|
|
''
|
|
mkdir -p /var/run/slapd
|
|
'';
|
|
exec = "${openldap}/libexec/slapd -f ${configFile}";
|
|
};
|
|
|
|
};
|
|
|
|
}
|