nixos/nscd: add package option

This commit is contained in:
Milan Pässler 2021-05-22 09:07:18 +02:00 committed by John Ericson
parent 685cececc2
commit 517c17420f

View file

@ -7,10 +7,6 @@ let
nssModulesPath = config.system.nssModules.path; nssModulesPath = config.system.nssModules.path;
cfg = config.services.nscd; cfg = config.services.nscd;
nscd = if pkgs.stdenv.hostPlatform.libc == "glibc"
then pkgs.stdenv.cc.libc.bin
else pkgs.glibc.bin;
in in
{ {
@ -37,6 +33,14 @@ in
description = "Configuration to use for Name Service Cache Daemon."; description = "Configuration to use for Name Service Cache Daemon.";
}; };
package = mkOption {
type = types.package;
default = if pkgs.stdenv.hostPlatform.libc == "glibc"
then pkgs.stdenv.cc.libc.bin
else pkgs.glibc.bin;
description = "package containing the nscd binary to be used by the service";
};
}; };
}; };
@ -69,16 +73,16 @@ in
# files. So prefix the ExecStart command with "!" to prevent systemd # files. So prefix the ExecStart command with "!" to prevent systemd
# from dropping privileges early. See ExecStart in systemd.service(5). # from dropping privileges early. See ExecStart in systemd.service(5).
serviceConfig = serviceConfig =
{ ExecStart = "!@${nscd}/sbin/nscd nscd"; { ExecStart = "!@${cfg.package}/bin/nscd nscd";
Type = "forking"; Type = "forking";
DynamicUser = true; DynamicUser = true;
RuntimeDirectory = "nscd"; RuntimeDirectory = "nscd";
PIDFile = "/run/nscd/nscd.pid"; PIDFile = "/run/nscd/nscd.pid";
Restart = "always"; Restart = "always";
ExecReload = ExecReload =
[ "${nscd}/sbin/nscd --invalidate passwd" [ "${cfg.package}/bin/nscd --invalidate passwd"
"${nscd}/sbin/nscd --invalidate group" "${cfg.package}/bin/nscd --invalidate group"
"${nscd}/sbin/nscd --invalidate hosts" "${cfg.package}/bin/nscd --invalidate hosts"
]; ];
}; };
}; };