2007-06-09 21:05:04 +01:00
|
|
|
{stdenv, dbus, dbusServices ? []}:
|
2007-06-08 19:56:55 +01:00
|
|
|
|
|
|
|
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
|
|
|
|
substitute ${dbus}/etc/dbus-1/system.conf $out/system.conf \\
|
|
|
|
--replace '<fork/>' ''
|
2007-06-09 21:05:04 +01:00
|
|
|
|
|
|
|
ensureDir $out/system.d
|
|
|
|
for i in ${toString dbusServices}; do
|
|
|
|
ln -s $i/etc/dbus-1/system.d/* $out/system.d/
|
|
|
|
done
|
2007-06-08 19:56:55 +01:00
|
|
|
";
|
|
|
|
};
|
|
|
|
|
|
|
|
in
|
|
|
|
|
|
|
|
{
|
|
|
|
name = "dbus";
|
|
|
|
|
|
|
|
users = [
|
|
|
|
{ name = "messagebus";
|
|
|
|
uid = (import ../system/ids.nix).uids.messagebus;
|
|
|
|
description = "D-Bus system message bus daemon user";
|
|
|
|
home = homeDir;
|
|
|
|
}
|
|
|
|
];
|
|
|
|
|
2008-03-04 14:58:48 +00:00
|
|
|
extraPath = [dbus.daemon dbus.tools];
|
2007-06-09 21:05:04 +01:00
|
|
|
|
2007-06-08 19:56:55 +01:00
|
|
|
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
|
2008-03-04 14:58:48 +00:00
|
|
|
${dbus.tools}/bin/dbus-uuidgen --ensure
|
2007-06-08 19:56:55 +01:00
|
|
|
|
|
|
|
end script
|
|
|
|
|
|
|
|
respawn
|
|
|
|
|
|
|
|
script
|
|
|
|
rm -f ${homeDir}/pid
|
|
|
|
exec ${dbus}/bin/dbus-daemon --config-file=${configFile}/system.conf
|
|
|
|
end script
|
|
|
|
";
|
|
|
|
|
|
|
|
}
|