nixpkgs/modules/services/system/nscd.nix
Eelco Dolstra 3ad370ae0a Merge remote-tracking branch 'origin/master' into systemd
Conflicts:
	modules/misc/ids.nix
	modules/services/mail/postfix.nix
	modules/services/system/nscd.nix
	modules/services/x11/desktop-managers/xfce.nix
	modules/system/boot/stage-1.nix
2012-09-28 11:35:27 -04:00

69 lines
1.3 KiB
Nix

{pkgs, config, ...}:
with pkgs.lib;
let
nssModulesPath = config.system.nssModules.path;
inherit (pkgs.lib) singleton;
in
{
###### interface
options = {
services.nscd = {
enable = mkOption {
default = true;
description = "Whether to enable the Name Service Cache Daemon.";
};
};
};
###### implementation
config = mkIf config.services.nscd.enable {
users.extraUsers = singleton
{ name = "nscd";
uid = config.ids.uids.nscd;
description = "Name service cache daemon user";
};
boot.systemd.services.nscd =
{ description = "Name Service Cache Daemon";
wantedBy = [ "multi-user.target" ];
environment = { LD_LIBRARY_PATH = nssModulesPath; };
preStart =
''
mkdir -m 0755 -p /run/nscd
rm -f /run/nscd/nscd.pid
mkdir -m 0755 -p /var/db/nscd
'';
serviceConfig =
''
ExecStart=@${pkgs.glibc}/sbin/nscd nscd -f ${./nscd.conf}
Type=forking
PIDFile=/run/nscd/nscd.pid
Restart=always
ExecReload=${pkgs.glibc}/sbin/nscd --invalidate passwd
ExecReload=${pkgs.glibc}/sbin/nscd --invalidate group
ExecReload=${pkgs.glibc}/sbin/nscd --invalidate hosts
'';
};
};
}