diff --git a/system/upstart.nix b/system/upstart.nix index dc89e62c098..86ca22ca7d9 100644 --- a/system/upstart.nix +++ b/system/upstart.nix @@ -76,6 +76,11 @@ import ../upstart-jobs/gather.nix { inherit (pkgs) cron; }) + # Name service cache daemon. + (import ../upstart-jobs/nscd.nix { + inherit (pkgs) glibc pwdutils; + }) + # Handles the maintenance/stalled event (single-user shell). (import ../upstart-jobs/maintenance-shell.nix { inherit (pkgs) bash; diff --git a/upstart-jobs/nscd.conf b/upstart-jobs/nscd.conf new file mode 100644 index 00000000000..786f5fdd8ac --- /dev/null +++ b/upstart-jobs/nscd.conf @@ -0,0 +1,27 @@ +server-user nscd +paranoia no +debug-level 0 + +enable-cache passwd yes +positive-time-to-live passwd 600 +negative-time-to-live passwd 20 +suggested-size passwd 211 +check-files passwd yes +persistent passwd yes +shared passwd yes + +enable-cache group yes +positive-time-to-live group 3600 +negative-time-to-live group 60 +suggested-size group 211 +check-files group yes +persistent group yes +shared group yes + +enable-cache hosts yes +positive-time-to-live hosts 600 +negative-time-to-live hosts 5 +suggested-size hosts 211 +check-files hosts yes +persistent hosts no +shared hosts yes diff --git a/upstart-jobs/nscd.nix b/upstart-jobs/nscd.nix new file mode 100644 index 00000000000..1e6b39dd9b3 --- /dev/null +++ b/upstart-jobs/nscd.nix @@ -0,0 +1,29 @@ +{glibc, pwdutils}: + +{ + name = "nscd"; + + job = " +description \"Name Service Cache Daemon\" + +start on startup +stop on shutdown + +start script + + if ! ${glibc}/bin/getent passwd nscd > /dev/null; then + ${pwdutils}/sbin/useradd -g nogroup -d /var/empty -s /noshell \\ + -c 'Name service cache daemon user' nscd + fi + + mkdir -m 0755 -p /var/run/nscd + mkdir -m 0755 -p /var/db/nscd + +end script + +# !!! -d turns on debug info which probably makes nscd slower +# 2>/dev/null is to make it shut up +respawn ${glibc}/sbin/nscd -f ${./nscd.conf} -d 2> /dev/null + "; + +}