From b6e3cd71707471a43cb95bb3bef8f12dd4b479df Mon Sep 17 00:00:00 2001 From: Jaka Hudoklin Date: Fri, 31 Jan 2014 14:07:44 +0100 Subject: [PATCH] nixos/nscd: add option to change nscd config MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit [Bjørn Forsman : - use types.lines instead of types.string. The former joins strings with "\n" and the latter with "" (and is deprecated). ] --- nixos/modules/services/system/nscd.nix | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/nixos/modules/services/system/nscd.nix b/nixos/modules/services/system/nscd.nix index b817b1df779f..3259bdbbe128 100644 --- a/nixos/modules/services/system/nscd.nix +++ b/nixos/modules/services/system/nscd.nix @@ -5,6 +5,7 @@ with pkgs.lib; let nssModulesPath = config.system.nssModules.path; + cfg = config.services.nscd; inherit (pkgs.lib) singleton; @@ -24,6 +25,12 @@ in 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 - config = mkIf config.services.nscd.enable { + config = mkIf cfg.enable { users.extraUsers = singleton { name = "nscd"; @@ -56,7 +63,7 @@ in restartTriggers = [ config.environment.etc.hosts.source ]; 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"; PIDFile = "/run/nscd/nscd.pid"; Restart = "always";