···
30
+
enableNsncd = mkOption {
33
+
description = lib.mdDoc ''
34
+
Whether to use nsncd instead of nscd.
35
+
This is a nscd-compatible daemon, that proxies lookups, without any caching.
···
then pkgs.stdenv.cc.libc.bin
63
-
description = lib.mdDoc "package containing the nscd binary to be used by the service";
72
+
description = lib.mdDoc ''
73
+
package containing the nscd binary to be used by the service.
74
+
Ignored when enableNsncd is set to true.
···
85
-
description = "Name Service Cache Daemon";
97
+
description = "Name Service Cache Daemon"
98
+
+ lib.optionalString cfg.enableNsncd " (nsncd)";
before = [ "nss-lookup.target" "nss-user-lookup.target" ];
wants = [ "nss-lookup.target" "nss-user-lookup.target" ];
···
environment = { LD_LIBRARY_PATH = nssModulesPath; };
107
+
restartTriggers = lib.optionals (!cfg.enableNsncd) ([
config.environment.etc.hosts.source
config.environment.etc."nsswitch.conf".source
config.environment.etc."nscd.conf".source
] ++ optionals config.users.mysql.enable [
config.environment.etc."libnss-mysql.cfg".source
config.environment.etc."libnss-mysql-root.cfg".source
# In some configurations, nscd needs to be started as root; it will
# drop privileges after all the NSS modules have read their
···
# and so users can set the owner of those files to the nscd user.
112
-
ExecStart = "!@${cfg.package}/bin/nscd nscd";
126
+
if cfg.enableNsncd then "${pkgs.nsncd}/bin/nsncd"
127
+
else "!@${cfg.package}/bin/nscd nscd";
128
+
Type = if cfg.enableNsncd then "notify" else "forking";
···
PIDFile = "/run/nscd/nscd.pid";
141
+
lib.optionals (!cfg.enableNsncd) [
"${cfg.package}/bin/nscd --invalidate passwd"
"${cfg.package}/bin/nscd --invalidate group"
"${cfg.package}/bin/nscd --invalidate hosts"