Author: eelco
Date: Tue Jul 13 09:22:52 2010
New Revision: 22572
URL: https://svn.nixos.org/websvn/nix/?rev=22572&sc=1

Log:
* dbus-daemon: use /etc/dbus-1/system.conf (i.e. ‘--system’) rather than
  ${configDir}/system.conf.  This is necessary to enable dbus to
  reload its configuration on SIGHUP after a nixos-rebuild.  (The
  daemon cannot be restarted because then console-kit-daemon loses its
  state.)
* Generate a proper /etc/dbus-1/session.conf.

Modified:
   nixos/trunk/modules/services/system/dbus.nix

Modified: nixos/trunk/modules/services/system/dbus.nix
==============================================================================
--- nixos/trunk/modules/services/system/dbus.nix        Tue Jul 13 08:56:02 
2010        (r22571)
+++ nixos/trunk/modules/services/system/dbus.nix        Tue Jul 13 09:22:52 
2010        (r22572)
@@ -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 @@
     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|<servicehelper>.*/libexec/dbus-daemon-launch-helper|<servicehelper>${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|<standard_system_servicedirs/>|${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|<standard_session_servicedirs />|${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 @@
     (d: "<servicedir>${d}/share/dbus-1/system-services</servicedir> ")
     cfg.packages;
 
+  sessionServiceDirs = concatMapStrings
+    (d: "<servicedir>${d}/share/dbus-1/services</servicedir> ")
+    cfg.packages;
+
 in
 
 {
@@ -88,7 +99,7 @@
 
   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 @@
 
         daemonType = "fork";
 
-        exec = "${dbus}/bin/dbus-daemon 
--config-file=${configDir}/system.conf";
+        exec = "${dbus}/bin/dbus-daemon --system";
 
         postStop =
           ''
_______________________________________________
nix-commits mailing list
[email protected]
http://mail.cs.uu.nl/mailman/listinfo/nix-commits

Reply via email to