* Added a job to start the D-Bus system-wide message bus daemon.

svn path=/nixos/trunk/; revision=8848
This commit is contained in:
Eelco Dolstra 2007-06-08 18:56:55 +00:00
parent 29c5178bdf
commit f70df0b275
3 changed files with 72 additions and 0 deletions

View File

@ -792,6 +792,16 @@
}
{
name = ["services" "dbus" "enable"];
default = true;
description = "
Whether to start the D-Bus message bus daemon. It is required
by the HAL service.
";
}
{
name = ["installer" "nixpkgsURL"];
default = "";

56
upstart-jobs/dbus.nix Normal file
View File

@ -0,0 +1,56 @@
{stdenv, dbus}:
let
homeDir = "/var/run/dbus";
# Take the standard system configuration file, except that we don't
# want to fork (Upstart will monitor the daemon).
configFile = stdenv.mkDerivation {
name = "dbus-conf";
buildCommand = "
ensureDir $out
ensureDir $out/system.d
substitute ${dbus}/etc/dbus-1/system.conf $out/system.conf \\
--replace '<fork/>' ''
";
};
in
{
name = "dbus";
users = [
{ name = "messagebus";
uid = (import ../system/ids.nix).uids.messagebus;
description = "D-Bus system message bus daemon user";
home = homeDir;
}
];
job = "
description \"D-Bus system message bus daemon\"
start on startup
stop on shutdown
start script
mkdir -m 0755 -p ${homeDir}
chown messagebus ${homeDir}
mkdir -m 0755 -p /var/lib/dbus
${dbus}/bin/dbus-uuidgen --ensure
end script
respawn
script
rm -f ${homeDir}/pid
exec ${dbus}/bin/dbus-daemon --config-file=${configFile}/system.conf
end script
";
}

View File

@ -182,6 +182,12 @@ import ../upstart-jobs/gather.nix {
inherit (pkgs) alsaUtils;
})
# D-Bus system-wide daemon.
++ optional ["services" "dbus" "enable"]
(import ../upstart-jobs/dbus.nix {
inherit (pkgs) stdenv dbus;
})
# Handles the reboot/halt events.
++ (map
(event: makeJob (import ../upstart-jobs/halt.nix {