From 44656be396fd9b7d46d133f8d5238db521793750 Mon Sep 17 00:00:00 2001 From: Eelco Dolstra Date: Tue, 13 Jul 2010 09:22:52 +0000 Subject: [PATCH] =?UTF-8?q?*=20dbus-daemon:=20use=20/etc/dbus-1/system.con?= =?UTF-8?q?f=20(i.e.=20=E2=80=98--system=E2=80=99)=20rather=20than=20=20?= =?UTF-8?q?=20${configDir}/system.conf.=20=20This=20is=20necessary=20to=20?= =?UTF-8?q?enable=20dbus=20to=20=20=20reload=20its=20configuration=20on=20?= =?UTF-8?q?SIGHUP=20after=20a=20nixos-rebuild.=20=20(The=20=20=20daemon=20?= =?UTF-8?q?cannot=20be=20restarted=20because=20then=20console-kit-daemon?= =?UTF-8?q?=20loses=20its=20=20=20state.)=20*=20Generate=20a=20proper=20/e?= =?UTF-8?q?tc/dbus-1/session.conf.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit svn path=/nixos/trunk/; revision=22572 --- modules/services/system/dbus.nix | 33 +++++++++++++++++++++----------- 1 file changed, 22 insertions(+), 11 deletions(-) diff --git a/modules/services/system/dbus.nix b/modules/services/system/dbus.nix index 6dbee3e6a04..d6e647ac2dd 100644 --- a/modules/services/system/dbus.nix +++ b/modules/services/system/dbus.nix @@ -1,5 +1,6 @@ -# D-Bus system-wide daemon. -{pkgs, config, ...}: +# D-Bus configuration and system bus daemon. + +{ config, pkgs, ... }: with pkgs.lib; @@ -16,27 +17,33 @@ let buildCommand = '' ensureDir $out - ln -s ${dbus}/etc/dbus-1/session.conf $out/session.conf - cp ${dbus}/etc/dbus-1/system.conf $out/system.conf + # !!! Hm, these `sed' calls are rather error-prone... + # Tell the daemon where the setuid wrapper around # dbus-daemon-launch-helper lives. sed -i $out/system.conf \ -e 's|.*/libexec/dbus-daemon-launch-helper|${config.security.wrapperDir}/dbus-daemon-launch-helper|' - # Add the system-services directories to the daemon's search path. + # Add the system-services and system.d directories to the system + # bus search path. sed -i $out/system.conf \ -e 's||${systemServiceDirs}|' - - # Note: system.conf includes ./system.d (i.e. it has a relative, - # not absolute path). + + cp ${dbus}/etc/dbus-1/session.conf $out/session.conf + + # Add the services and session.d directories to the session bus + # search path. + sed -i $out/session.conf \ + -e 's||${sessionServiceDirs}|' + ensureDir $out/session.d ensureDir $out/system.d for i in ${toString cfg.packages}; do for j in $i/etc/dbus-1/session.d/*; do - ln -s $j $out/session.d/ + ln -s $j $out/session.d/ done for j in $i/etc/dbus-1/system.d/*; do ln -s $j $out/system.d/ @@ -49,6 +56,10 @@ let (d: "${d}/share/dbus-1/system-services ") cfg.packages; + sessionServiceDirs = concatMapStrings + (d: "${d}/share/dbus-1/services ") + cfg.packages; + in { @@ -88,7 +99,7 @@ in config = mkIf cfg.enable { - environment.systemPackages = [dbus.daemon dbus.tools]; + environment.systemPackages = [ dbus.daemon dbus.tools ]; environment.etc = singleton # We need /etc/dbus-1/system.conf for now, because @@ -128,7 +139,7 @@ in daemonType = "fork"; - exec = "${dbus}/bin/dbus-daemon --config-file=${configDir}/system.conf"; + exec = "${dbus}/bin/dbus-daemon --system"; postStop = ''