From 8eba736da9e6d7ff389554c3f6e0ca5ac089e3ee Mon Sep 17 00:00:00 2001 From: Eelco Dolstra Date: Fri, 25 Nov 2011 16:32:54 +0000 Subject: [PATCH] =?UTF-8?q?*=20Use=20the=20=E2=80=98path=E2=80=99=20attrib?= =?UTF-8?q?ute=20in=20Upstart=20jobs=20in=20more=20places.=20=20It's=20a?= =?UTF-8?q?=20bit=20=20=20more=20readable=20(also=20in=20"ps"=20output).?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit svn path=/nixos/trunk/; revision=30565 --- modules/services/hardware/acpid.nix | 6 +++++- modules/services/hardware/udev.nix | 14 ++++++++----- modules/services/logging/klogd.nix | 4 +++- modules/services/logging/syslogd.nix | 4 +++- modules/services/misc/nix-daemon.nix | 8 +++++--- modules/services/networking/dhclient.nix | 4 +++- modules/services/networking/ntpd.nix | 6 ++++-- .../services/networking/wpa_supplicant.nix | 5 +++-- modules/services/networking/xinetd.nix | 4 +++- modules/services/printing/cupsd.nix | 5 +++-- modules/services/scheduling/atd.nix | 4 +++- modules/services/scheduling/cron.nix | 4 +++- modules/services/system/dbus.nix | 6 ++++-- modules/services/system/nscd.nix | 4 +++- modules/services/ttys/mingetty.nix | 8 ++++---- .../web-servers/apache-httpd/default.nix | 20 +++++++++---------- .../web-servers/apache-httpd/mercurial.nix | 4 +--- .../web-servers/apache-httpd/zabbix.nix | 2 +- 18 files changed, 70 insertions(+), 42 deletions(-) diff --git a/modules/services/hardware/acpid.nix b/modules/services/hardware/acpid.nix index 84680bd3532..303db3816b5 100644 --- a/modules/services/hardware/acpid.nix +++ b/modules/services/hardware/acpid.nix @@ -99,7 +99,11 @@ in startOn = "stopped udevtrigger and started syslogd"; - exec = "${pkgs.acpid}/sbin/acpid --foreground --confdir ${acpiConfDir}"; + path = [ pkgs.acpid ]; + + daemonType = "fork"; + + exec = "acpid --confdir ${acpiConfDir}"; }; }; diff --git a/modules/services/hardware/udev.nix b/modules/services/hardware/udev.nix index 98443f9758a..143f8ebbad8 100644 --- a/modules/services/hardware/udev.nix +++ b/modules/services/hardware/udev.nix @@ -215,6 +215,8 @@ in environment = { UDEV_CONFIG_FILE = conf; }; + path = [ udev ]; + preStart = '' echo "" > /proc/sys/kernel/hotplug || true @@ -234,7 +236,7 @@ in daemonType = "fork"; - exec = "${udev}/sbin/udevd --daemon"; + exec = "udevd --daemon"; }; jobs.udevtrigger = @@ -242,6 +244,8 @@ in task = true; + path = [ udev ]; + script = '' # Let udev create device nodes for all modules that have already @@ -249,10 +253,10 @@ in # the kernel). The `STARTUP' variable is needed to force # the LVM rules to create device nodes. See # http://www.mail-archive.com/fedora-devel-list@redhat.com/msg10261.html - ${udev}/sbin/udevadm control --env=STARTUP=1 - ${udev}/sbin/udevadm trigger --action=add - ${udev}/sbin/udevadm settle # wait for udev to finish - ${udev}/sbin/udevadm control --env=STARTUP= + udevadm control --env=STARTUP=1 + udevadm trigger --action=add + udevadm settle # wait for udev to finish + udevadm control --env=STARTUP= initctl emit -n new-devices ''; diff --git a/modules/services/logging/klogd.nix b/modules/services/logging/klogd.nix index 2f4bd411e58..af21f9cc959 100644 --- a/modules/services/logging/klogd.nix +++ b/modules/services/logging/klogd.nix @@ -9,8 +9,10 @@ startOn = "started syslogd"; + path = [ pkgs.sysklogd ]; + exec = - "${pkgs.sysklogd}/sbin/klogd -c 1 -2 -n " + + "klogd -c 1 -2 -n " + "-k $(dirname $(readlink -f /var/run/booted-system/kernel))/System.map"; }; diff --git a/modules/services/logging/syslogd.nix b/modules/services/logging/syslogd.nix index bb088c250f6..715cfc0f9e6 100644 --- a/modules/services/logging/syslogd.nix +++ b/modules/services/logging/syslogd.nix @@ -102,7 +102,9 @@ in daemonType = "fork"; - exec = "${pkgs.sysklogd}/sbin/syslogd ${toString cfg.extraParams} -f ${syslogConf}"; + path = [ pkgs.sysklogd ]; + + exec = "syslogd ${toString cfg.extraParams} -f ${syslogConf}"; }; }; diff --git a/modules/services/misc/nix-daemon.nix b/modules/services/misc/nix-daemon.nix index 1f95e63b64a..c8eaf15ff77 100644 --- a/modules/services/misc/nix-daemon.nix +++ b/modules/services/misc/nix-daemon.nix @@ -249,14 +249,16 @@ in startOn = "startup"; + path = [ nix pkgs.openssl pkgs.utillinux ] + ++ optionals config.nix.distributedBuilds [ pkgs.openssh pkgs.gzip ]; + script = '' - export PATH=${if config.nix.distributedBuilds then "${pkgs.openssh}/bin:${pkgs.gzip}/bin:" else ""}${pkgs.openssl}/bin:${nix}/bin:$PATH ${config.nix.envVars} exec \ nice -n ${builtins.toString config.nix.daemonNiceLevel} \ - ${pkgs.utillinux}/bin/ionice -n ${builtins.toString config.nix.daemonIONiceLevel} \ - ${nix}/bin/nix-worker --daemon > /dev/null 2>&1 + ionice -n ${builtins.toString config.nix.daemonIONiceLevel} \ + nix-worker --daemon > /dev/null 2>&1 ''; extraConfig = diff --git a/modules/services/networking/dhclient.nix b/modules/services/networking/dhclient.nix index 0a353ae1eab..38454d421b1 100644 --- a/modules/services/networking/dhclient.nix +++ b/modules/services/networking/dhclient.nix @@ -67,6 +67,8 @@ in { startOn = "started network-interfaces"; stopOn = "stopping network-interfaces"; + path = [ dhcp ]; + preStart = '' # dhclient barfs if /proc/net/if_inet6 doesn't exist. @@ -101,7 +103,7 @@ in mkdir -m 755 -p ${stateDir} - exec ${dhcp}/sbin/dhclient -d $interfaces -e "PATH=$PATH" -lf ${stateDir}/dhclient.leases -sf ${dhcp}/sbin/dhclient-script + exec dhclient -d $interfaces -e "PATH=$PATH" -lf ${stateDir}/dhclient.leases -sf ${dhcp}/sbin/dhclient-script ''; }; diff --git a/modules/services/networking/ntpd.nix b/modules/services/networking/ntpd.nix index 6e3040a2ae1..b8624cd6cdf 100644 --- a/modules/services/networking/ntpd.nix +++ b/modules/services/networking/ntpd.nix @@ -75,6 +75,8 @@ in startOn = "ip-up"; + path = [ ntp ]; + preStart = '' mkdir -m 0755 -p ${stateDir} @@ -88,10 +90,10 @@ in # because Upstart cannot kill jobs stuck in the start # phase. Thus a hanging ntpd job can block system # shutdown. - # ${ntp}/bin/ntpd -q -g ${ntpFlags} + # ntpd -q -g ${ntpFlags} ''; - exec = "${ntp}/bin/ntpd -g -n ${ntpFlags}"; + exec = "ntpd -g -n ${ntpFlags}"; }; }; diff --git a/modules/services/networking/wpa_supplicant.nix b/modules/services/networking/wpa_supplicant.nix index a349a721b12..547280931c9 100644 --- a/modules/services/networking/wpa_supplicant.nix +++ b/modules/services/networking/wpa_supplicant.nix @@ -48,6 +48,8 @@ in { startOn = "started network-interfaces"; stopOn = "stopping network-interfaces"; + path = [ pkgs.wpa_supplicant ]; + preStart = '' touch -a ${configFile} @@ -55,8 +57,7 @@ in ''; exec = - "${pkgs.wpa_supplicant}/sbin/wpa_supplicant " + - "-s -C /var/run/wpa_supplicant " + + "wpa_supplicant -s -C /var/run/wpa_supplicant " + "-c ${configFile} -i${config.networking.WLANInterface}"; }; diff --git a/modules/services/networking/xinetd.nix b/modules/services/networking/xinetd.nix index 0bd6052c125..aabb7cf9f8a 100644 --- a/modules/services/networking/xinetd.nix +++ b/modules/services/networking/xinetd.nix @@ -132,7 +132,9 @@ in startOn = "started network-interfaces"; stopOn = "stopping network-interfaces"; - exec = "${xinetd}/sbin/xinetd -syslog daemon -dontfork -stayalive -f ${configFile}"; + path = [ xinetd ]; + + exec = "xinetd -syslog daemon -dontfork -stayalive -f ${configFile}"; }; }; diff --git a/modules/services/printing/cupsd.nix b/modules/services/printing/cupsd.nix index e33e2245dbc..8ba4a41e0de 100644 --- a/modules/services/printing/cupsd.nix +++ b/modules/services/printing/cupsd.nix @@ -129,7 +129,8 @@ in startOn = "started network-interfaces"; stopOn = "stopping network-interfaces"; - path = [ config.system.path ]; + # !!! Why is config.system.path in here? + path = [ cups config.system.path ]; preStart = '' @@ -140,7 +141,7 @@ in mkdir -m 0755 -p ${cfg.tempDir} ''; - exec = "${cups}/sbin/cupsd -c ${pkgs.writeText "cupsd.conf" cfg.cupsdConf} -F"; + exec = "cupsd -c ${pkgs.writeText "cupsd.conf" cfg.cupsdConf} -F"; }; services.printing.drivers = [ pkgs.cups pkgs.cups_pdf_filter pkgs.ghostscript additionalBackends ]; diff --git a/modules/services/scheduling/atd.nix b/modules/services/scheduling/atd.nix index 8213f4b3667..6e6eaec1db9 100644 --- a/modules/services/scheduling/atd.nix +++ b/modules/services/scheduling/atd.nix @@ -68,6 +68,8 @@ in startOn = "stopped udevtrigger"; + path = [ at ]; + preStart = '' # Snippets taken and adapted from the original `install' rule of @@ -99,7 +101,7 @@ in fi ''; - exec = "${at}/sbin/atd"; + exec = "atd"; daemonType = "fork"; }; diff --git a/modules/services/scheduling/cron.nix b/modules/services/scheduling/cron.nix index 86ac32b94dc..350d65b476a 100644 --- a/modules/services/scheduling/cron.nix +++ b/modules/services/scheduling/cron.nix @@ -93,6 +93,8 @@ in # Needed to interpret times in the local timezone. environment = { TZ = config.time.timeZone; }; + path = [ cronNixosPkg ]; + preStart = '' mkdir -m 710 -p /var/cron @@ -104,7 +106,7 @@ in fi ''; - exec = "${cronNixosPkg}/sbin/cron -n"; + exec = "cron -n"; }; }; diff --git a/modules/services/system/dbus.nix b/modules/services/system/dbus.nix index 4f6d577e936..2808b0241c2 100644 --- a/modules/services/system/dbus.nix +++ b/modules/services/system/dbus.nix @@ -118,20 +118,22 @@ in jobs.dbus = { startOn = "started udev and started syslogd"; + path = [ pkgs.dbus_daemon pkgs.dbus_tools ]; + preStart = '' mkdir -m 0755 -p ${homeDir} chown messagebus ${homeDir} mkdir -m 0755 -p /var/lib/dbus - ${pkgs.dbus_tools}/bin/dbus-uuidgen --ensure + dbus-uuidgen --ensure rm -f ${homeDir}/pid ''; daemonType = "fork"; - exec = "${pkgs.dbus_daemon}/bin/dbus-daemon --system"; + exec = "dbus-daemon --system"; postStop = '' diff --git a/modules/services/system/nscd.nix b/modules/services/system/nscd.nix index 971b73706ae..22d6e38a74b 100644 --- a/modules/services/system/nscd.nix +++ b/modules/services/system/nscd.nix @@ -52,7 +52,9 @@ in mkdir -m 0755 -p /var/db/nscd ''; - exec = "${pkgs.glibc}/sbin/nscd -f ${./nscd.conf} -d 2> /dev/null"; + path = [ pkgs.glibc ]; + + exec = "nscd -f ${./nscd.conf} -d 2> /dev/null"; }; }; diff --git a/modules/services/ttys/mingetty.nix b/modules/services/ttys/mingetty.nix index 3b7ae240d54..5a86dada1f2 100644 --- a/modules/services/ttys/mingetty.nix +++ b/modules/services/ttys/mingetty.nix @@ -60,11 +60,11 @@ with pkgs.lib; startOn = "started udev and filesystem"; - exec = "${pkgs.mingetty}/sbin/mingetty --loginprog=${pkgs.shadow}/bin/login --noclear ${tty}"; + path = [ pkgs.mingetty ]; - environment = { - LOCALE_ARCHIVE = "/var/run/current-system/sw/lib/locale/locale-archive"; - }; + exec = "mingetty --loginprog=${pkgs.shadow}/bin/login --noclear ${tty}"; + + environment.LOCALE_ARCHIVE = "/var/run/current-system/sw/lib/locale/locale-archive"; }) config.services.mingetty.ttys); diff --git a/modules/services/web-servers/apache-httpd/default.nix b/modules/services/web-servers/apache-httpd/default.nix index 39f087e4ccf..f37ed56608d 100644 --- a/modules/services/web-servers/apache-httpd/default.nix +++ b/modules/services/web-servers/apache-httpd/default.nix @@ -562,16 +562,16 @@ in # the latter is enabled. + optionalString config.services.postgresql.enable " and started postgresql"; - environment = - { PATH = concatStringsSep ":" ( - [ "${pkgs.coreutils}/bin" "${pkgs.gnugrep}/bin" ] - ++ # Needed for PHP's mail() function. !!! Probably the - # ssmtp module should export the path to sendmail in - # some way. - optional config.networking.defaultMailServer.directDelivery "${pkgs.ssmtp}/sbin" - ++ (concatMap (svc: svc.extraServerPath) allSubservices) ); + path = + [ httpd pkgs.coreutils pkgs.gnugrep ] + ++ # Needed for PHP's mail() function. !!! Probably the + # ssmtp module should export the path to sendmail in + # some way. + optional config.networking.defaultMailServer.directDelivery pkgs.ssmtp + ++ concatMap (svc: svc.extraServerPath) allSubservices; - PHPRC = if enablePHP then phpIni else ""; + environment = + { PHPRC = if enablePHP then phpIni else ""; TZ = config.time.timeZone; @@ -605,7 +605,7 @@ in daemonType = "fork"; - exec = "${httpd}/bin/httpd -f ${httpdConf}"; + exec = "httpd -f ${httpdConf}"; preStop = '' diff --git a/modules/services/web-servers/apache-httpd/mercurial.nix b/modules/services/web-servers/apache-httpd/mercurial.nix index ad1c332a657..755b595c783 100644 --- a/modules/services/web-servers/apache-httpd/mercurial.nix +++ b/modules/services/web-servers/apache-httpd/mercurial.nix @@ -51,9 +51,7 @@ in { Disallow: ${urlPrefix} ''; - extraServerPath = [ - (pkgs.python+"/bin") - ]; + extraServerPath = [ pkgs.python ]; globalEnvVars = [ { name = "PYTHONPATH"; value = "${mercurial}/lib/${pkgs.python.libPrefix}/site-packages"; } ]; diff --git a/modules/services/web-servers/apache-httpd/zabbix.nix b/modules/services/web-servers/apache-httpd/zabbix.nix index 66b6c0ea9b0..385e9ab5644 100644 --- a/modules/services/web-servers/apache-httpd/zabbix.nix +++ b/modules/services/web-servers/apache-httpd/zabbix.nix @@ -46,7 +46,7 @@ in ''; # The frontend needs "ps" to find out whether zabbix_server is running. - extraServerPath = ["${pkgs.procps}/bin"]; + extraServerPath = [ pkgs.procps ]; options = {