about summary refs log tree commit diff
path: root/nixos
diff options
context:
space:
mode:
authorJaka Hudoklin <jakahudoklin@gmail.com>2014-01-31 14:07:44 +0100
committerBjørn Forsman <bjorn.forsman@gmail.com>2014-02-02 15:31:55 +0100
commitb6e3cd71707471a43cb95bb3bef8f12dd4b479df (patch)
treefb589d463426fd816ac1da5960d25fac50890937 /nixos
parent43af271ac6171902cf1953cec7e5f926a33695a5 (diff)
downloadnixlib-b6e3cd71707471a43cb95bb3bef8f12dd4b479df.tar
nixlib-b6e3cd71707471a43cb95bb3bef8f12dd4b479df.tar.gz
nixlib-b6e3cd71707471a43cb95bb3bef8f12dd4b479df.tar.bz2
nixlib-b6e3cd71707471a43cb95bb3bef8f12dd4b479df.tar.lz
nixlib-b6e3cd71707471a43cb95bb3bef8f12dd4b479df.tar.xz
nixlib-b6e3cd71707471a43cb95bb3bef8f12dd4b479df.tar.zst
nixlib-b6e3cd71707471a43cb95bb3bef8f12dd4b479df.zip
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).
]
Diffstat (limited to 'nixos')
-rw-r--r--nixos/modules/services/system/nscd.nix11
1 files 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";