* Use the ‘path’ attribute in Upstart jobs in more places. It's a bit

more readable (also in "ps" output).

svn path=/nixos/trunk/; revision=30565
This commit is contained in:
Eelco Dolstra 2011-11-25 16:32:54 +00:00
parent 1d5d7036d0
commit 8eba736da9
18 changed files with 70 additions and 42 deletions

View File

@ -99,7 +99,11 @@ in
startOn = "stopped udevtrigger and started syslogd"; startOn = "stopped udevtrigger and started syslogd";
exec = "${pkgs.acpid}/sbin/acpid --foreground --confdir ${acpiConfDir}"; path = [ pkgs.acpid ];
daemonType = "fork";
exec = "acpid --confdir ${acpiConfDir}";
}; };
}; };

View File

@ -215,6 +215,8 @@ in
environment = { UDEV_CONFIG_FILE = conf; }; environment = { UDEV_CONFIG_FILE = conf; };
path = [ udev ];
preStart = preStart =
'' ''
echo "" > /proc/sys/kernel/hotplug || true echo "" > /proc/sys/kernel/hotplug || true
@ -234,7 +236,7 @@ in
daemonType = "fork"; daemonType = "fork";
exec = "${udev}/sbin/udevd --daemon"; exec = "udevd --daemon";
}; };
jobs.udevtrigger = jobs.udevtrigger =
@ -242,6 +244,8 @@ in
task = true; task = true;
path = [ udev ];
script = script =
'' ''
# Let udev create device nodes for all modules that have already # 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 kernel). The `STARTUP' variable is needed to force
# the LVM rules to create device nodes. See # the LVM rules to create device nodes. See
# http://www.mail-archive.com/fedora-devel-list@redhat.com/msg10261.html # http://www.mail-archive.com/fedora-devel-list@redhat.com/msg10261.html
${udev}/sbin/udevadm control --env=STARTUP=1 udevadm control --env=STARTUP=1
${udev}/sbin/udevadm trigger --action=add udevadm trigger --action=add
${udev}/sbin/udevadm settle # wait for udev to finish udevadm settle # wait for udev to finish
${udev}/sbin/udevadm control --env=STARTUP= udevadm control --env=STARTUP=
initctl emit -n new-devices initctl emit -n new-devices
''; '';

View File

@ -9,8 +9,10 @@
startOn = "started syslogd"; startOn = "started syslogd";
path = [ pkgs.sysklogd ];
exec = 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"; "-k $(dirname $(readlink -f /var/run/booted-system/kernel))/System.map";
}; };

View File

@ -102,7 +102,9 @@ in
daemonType = "fork"; daemonType = "fork";
exec = "${pkgs.sysklogd}/sbin/syslogd ${toString cfg.extraParams} -f ${syslogConf}"; path = [ pkgs.sysklogd ];
exec = "syslogd ${toString cfg.extraParams} -f ${syslogConf}";
}; };
}; };

View File

@ -249,14 +249,16 @@ in
startOn = "startup"; startOn = "startup";
path = [ nix pkgs.openssl pkgs.utillinux ]
++ optionals config.nix.distributedBuilds [ pkgs.openssh pkgs.gzip ];
script = script =
'' ''
export PATH=${if config.nix.distributedBuilds then "${pkgs.openssh}/bin:${pkgs.gzip}/bin:" else ""}${pkgs.openssl}/bin:${nix}/bin:$PATH
${config.nix.envVars} ${config.nix.envVars}
exec \ exec \
nice -n ${builtins.toString config.nix.daemonNiceLevel} \ nice -n ${builtins.toString config.nix.daemonNiceLevel} \
${pkgs.utillinux}/bin/ionice -n ${builtins.toString config.nix.daemonIONiceLevel} \ ionice -n ${builtins.toString config.nix.daemonIONiceLevel} \
${nix}/bin/nix-worker --daemon > /dev/null 2>&1 nix-worker --daemon > /dev/null 2>&1
''; '';
extraConfig = extraConfig =

View File

@ -67,6 +67,8 @@ in
{ startOn = "started network-interfaces"; { startOn = "started network-interfaces";
stopOn = "stopping network-interfaces"; stopOn = "stopping network-interfaces";
path = [ dhcp ];
preStart = preStart =
'' ''
# dhclient barfs if /proc/net/if_inet6 doesn't exist. # dhclient barfs if /proc/net/if_inet6 doesn't exist.
@ -101,7 +103,7 @@ in
mkdir -m 755 -p ${stateDir} 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
''; '';
}; };

View File

@ -75,6 +75,8 @@ in
startOn = "ip-up"; startOn = "ip-up";
path = [ ntp ];
preStart = preStart =
'' ''
mkdir -m 0755 -p ${stateDir} mkdir -m 0755 -p ${stateDir}
@ -88,10 +90,10 @@ in
# because Upstart cannot kill jobs stuck in the start # because Upstart cannot kill jobs stuck in the start
# phase. Thus a hanging ntpd job can block system # phase. Thus a hanging ntpd job can block system
# shutdown. # shutdown.
# ${ntp}/bin/ntpd -q -g ${ntpFlags} # ntpd -q -g ${ntpFlags}
''; '';
exec = "${ntp}/bin/ntpd -g -n ${ntpFlags}"; exec = "ntpd -g -n ${ntpFlags}";
}; };
}; };

View File

@ -48,6 +48,8 @@ in
{ startOn = "started network-interfaces"; { startOn = "started network-interfaces";
stopOn = "stopping network-interfaces"; stopOn = "stopping network-interfaces";
path = [ pkgs.wpa_supplicant ];
preStart = preStart =
'' ''
touch -a ${configFile} touch -a ${configFile}
@ -55,8 +57,7 @@ in
''; '';
exec = exec =
"${pkgs.wpa_supplicant}/sbin/wpa_supplicant " + "wpa_supplicant -s -C /var/run/wpa_supplicant " +
"-s -C /var/run/wpa_supplicant " +
"-c ${configFile} -i${config.networking.WLANInterface}"; "-c ${configFile} -i${config.networking.WLANInterface}";
}; };

View File

@ -132,7 +132,9 @@ in
startOn = "started network-interfaces"; startOn = "started network-interfaces";
stopOn = "stopping 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}";
}; };
}; };

View File

@ -129,7 +129,8 @@ in
startOn = "started network-interfaces"; startOn = "started network-interfaces";
stopOn = "stopping network-interfaces"; stopOn = "stopping network-interfaces";
path = [ config.system.path ]; # !!! Why is config.system.path in here?
path = [ cups config.system.path ];
preStart = preStart =
'' ''
@ -140,7 +141,7 @@ in
mkdir -m 0755 -p ${cfg.tempDir} 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 ]; services.printing.drivers = [ pkgs.cups pkgs.cups_pdf_filter pkgs.ghostscript additionalBackends ];

View File

@ -68,6 +68,8 @@ in
startOn = "stopped udevtrigger"; startOn = "stopped udevtrigger";
path = [ at ];
preStart = preStart =
'' ''
# Snippets taken and adapted from the original `install' rule of # Snippets taken and adapted from the original `install' rule of
@ -99,7 +101,7 @@ in
fi fi
''; '';
exec = "${at}/sbin/atd"; exec = "atd";
daemonType = "fork"; daemonType = "fork";
}; };

View File

@ -93,6 +93,8 @@ in
# Needed to interpret times in the local timezone. # Needed to interpret times in the local timezone.
environment = { TZ = config.time.timeZone; }; environment = { TZ = config.time.timeZone; };
path = [ cronNixosPkg ];
preStart = preStart =
'' ''
mkdir -m 710 -p /var/cron mkdir -m 710 -p /var/cron
@ -104,7 +106,7 @@ in
fi fi
''; '';
exec = "${cronNixosPkg}/sbin/cron -n"; exec = "cron -n";
}; };
}; };

View File

@ -118,20 +118,22 @@ in
jobs.dbus = jobs.dbus =
{ startOn = "started udev and started syslogd"; { startOn = "started udev and started syslogd";
path = [ pkgs.dbus_daemon pkgs.dbus_tools ];
preStart = preStart =
'' ''
mkdir -m 0755 -p ${homeDir} mkdir -m 0755 -p ${homeDir}
chown messagebus ${homeDir} chown messagebus ${homeDir}
mkdir -m 0755 -p /var/lib/dbus mkdir -m 0755 -p /var/lib/dbus
${pkgs.dbus_tools}/bin/dbus-uuidgen --ensure dbus-uuidgen --ensure
rm -f ${homeDir}/pid rm -f ${homeDir}/pid
''; '';
daemonType = "fork"; daemonType = "fork";
exec = "${pkgs.dbus_daemon}/bin/dbus-daemon --system"; exec = "dbus-daemon --system";
postStop = postStop =
'' ''

View File

@ -52,7 +52,9 @@ in
mkdir -m 0755 -p /var/db/nscd 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";
}; };
}; };

View File

@ -60,11 +60,11 @@ with pkgs.lib;
startOn = "started udev and filesystem"; startOn = "started udev and filesystem";
exec = "${pkgs.mingetty}/sbin/mingetty --loginprog=${pkgs.shadow}/bin/login --noclear ${tty}"; path = [ pkgs.mingetty ];
environment = { exec = "mingetty --loginprog=${pkgs.shadow}/bin/login --noclear ${tty}";
LOCALE_ARCHIVE = "/var/run/current-system/sw/lib/locale/locale-archive";
}; environment.LOCALE_ARCHIVE = "/var/run/current-system/sw/lib/locale/locale-archive";
}) config.services.mingetty.ttys); }) config.services.mingetty.ttys);

View File

@ -562,16 +562,16 @@ in
# the latter is enabled. # the latter is enabled.
+ optionalString config.services.postgresql.enable " and started postgresql"; + optionalString config.services.postgresql.enable " and started postgresql";
environment = path =
{ PATH = concatStringsSep ":" ( [ httpd pkgs.coreutils pkgs.gnugrep ]
[ "${pkgs.coreutils}/bin" "${pkgs.gnugrep}/bin" ] ++ # Needed for PHP's mail() function. !!! Probably the
++ # Needed for PHP's mail() function. !!! Probably the # ssmtp module should export the path to sendmail in
# ssmtp module should export the path to sendmail in # some way.
# some way. optional config.networking.defaultMailServer.directDelivery pkgs.ssmtp
optional config.networking.defaultMailServer.directDelivery "${pkgs.ssmtp}/sbin" ++ concatMap (svc: svc.extraServerPath) allSubservices;
++ (concatMap (svc: svc.extraServerPath) allSubservices) );
PHPRC = if enablePHP then phpIni else ""; environment =
{ PHPRC = if enablePHP then phpIni else "";
TZ = config.time.timeZone; TZ = config.time.timeZone;
@ -605,7 +605,7 @@ in
daemonType = "fork"; daemonType = "fork";
exec = "${httpd}/bin/httpd -f ${httpdConf}"; exec = "httpd -f ${httpdConf}";
preStop = preStop =
'' ''

View File

@ -51,9 +51,7 @@ in {
Disallow: ${urlPrefix} Disallow: ${urlPrefix}
''; '';
extraServerPath = [ extraServerPath = [ pkgs.python ];
(pkgs.python+"/bin")
];
globalEnvVars = [ { name = "PYTHONPATH"; value = "${mercurial}/lib/${pkgs.python.libPrefix}/site-packages"; } ]; globalEnvVars = [ { name = "PYTHONPATH"; value = "${mercurial}/lib/${pkgs.python.libPrefix}/site-packages"; } ];

View File

@ -46,7 +46,7 @@ in
''; '';
# The frontend needs "ps" to find out whether zabbix_server is running. # The frontend needs "ps" to find out whether zabbix_server is running.
extraServerPath = ["${pkgs.procps}/bin"]; extraServerPath = [ pkgs.procps ];
options = { options = {