nixos/nscd: add option to change nscd config

[Bjørn Forsman <bjorn.forsman@gmail.com>:
 - use types.lines instead of types.string. The former joins strings
   with "\n" and the latter with "" (and is deprecated).
]
This commit is contained in:
Jaka Hudoklin 2014-01-31 14:07:44 +01:00 committed by Bjørn Forsman
parent 43af271ac6
commit b6e3cd7170

View File

@ -5,6 +5,7 @@ with pkgs.lib;
let let
nssModulesPath = config.system.nssModules.path; nssModulesPath = config.system.nssModules.path;
cfg = config.services.nscd;
inherit (pkgs.lib) singleton; inherit (pkgs.lib) singleton;
@ -24,6 +25,12 @@ in
description = "Whether to enable the Name Service Cache Daemon."; description = "Whether to enable the Name Service Cache Daemon.";
}; };
config = mkOption {
type = types.lines;
default = builtins.readFile ./nscd.conf;
description = "Configuration to use for Name Service Cache Daemon.";
};
}; };
}; };
@ -31,7 +38,7 @@ in
###### implementation ###### implementation
config = mkIf config.services.nscd.enable { config = mkIf cfg.enable {
users.extraUsers = singleton users.extraUsers = singleton
{ name = "nscd"; { name = "nscd";
@ -56,7 +63,7 @@ in
restartTriggers = [ config.environment.etc.hosts.source ]; restartTriggers = [ config.environment.etc.hosts.source ];
serviceConfig = serviceConfig =
{ ExecStart = "@${pkgs.glibc}/sbin/nscd nscd -f ${./nscd.conf}"; { ExecStart = "@${pkgs.glibc}/sbin/nscd nscd -f ${pkgs.writeText "nscd.conf" cfg.config}";
Type = "forking"; Type = "forking";
PIDFile = "/run/nscd/nscd.pid"; PIDFile = "/run/nscd/nscd.pid";
Restart = "always"; Restart = "always";