summary refs log tree commit diff
path: root/nixos/modules/services/system/dbus.nix
diff options
context:
space:
mode:
authorWilliam A. Kennington III <william@wkennington.com>2016-03-06 17:38:53 -0800
committerThomas Tuegel <ttuegel@gmail.com>2016-05-02 13:04:20 -0500
commit60b34849284db4aec8f4fdab722273096e1ed002 (patch)
treef458386757900944ca33e90f9c4e3e5290dd70b5 /nixos/modules/services/system/dbus.nix
parentf04e0e70e8ddb82686a2f660d292e7338ed564d2 (diff)
downloadnixpkgs-60b34849284db4aec8f4fdab722273096e1ed002.tar
nixpkgs-60b34849284db4aec8f4fdab722273096e1ed002.tar.gz
nixpkgs-60b34849284db4aec8f4fdab722273096e1ed002.tar.bz2
nixpkgs-60b34849284db4aec8f4fdab722273096e1ed002.tar.lz
nixpkgs-60b34849284db4aec8f4fdab722273096e1ed002.tar.xz
nixpkgs-60b34849284db4aec8f4fdab722273096e1ed002.tar.zst
nixpkgs-60b34849284db4aec8f4fdab722273096e1ed002.zip
dbus: Fix for new 1.10 version
(cherry picked from commit 68a4a6df3971d66aa988bba680351a30fbadbed3)
Diffstat (limited to 'nixos/modules/services/system/dbus.nix')
-rw-r--r--nixos/modules/services/system/dbus.nix68
1 files changed, 24 insertions, 44 deletions
diff --git a/nixos/modules/services/system/dbus.nix b/nixos/modules/services/system/dbus.nix
index 59c2e482e1a..434211aaac4 100644
--- a/nixos/modules/services/system/dbus.nix
+++ b/nixos/modules/services/system/dbus.nix
@@ -10,6 +10,16 @@ let
 
   homeDir = "/var/run/dbus";
 
+  systemExtraxml = concatStrings (flip concatMap cfg.packages (d: [
+    "<servicedir>${d}/share/dbus-1/system-services</servicedir>"
+    "<includedir>${d}/etc/dbus-1/system.d</includedir>"
+  ]));
+
+  sessionExtraxml = concatStrings (flip concatMap cfg.packages (d: [
+    "<servicedir>${d}/share/dbus-1/services</servicedir>"
+    "<includedir>${d}/etc/dbus-1/session.d</includedir>"
+  ]));
+
   configDir = pkgs.stdenv.mkDerivation {
     name = "dbus-conf";
 
@@ -19,47 +29,17 @@ let
     buildCommand = ''
       mkdir -p $out
 
-      cp -v ${pkgs.dbus.daemon}/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 and system.d directories to the system
-      # bus search path.
-      sed -i $out/system.conf \
-          -e 's|<standard_system_servicedirs/>|${systemServiceDirs}|' \
-          -e 's|<includedir>system.d</includedir>|${systemIncludeDirs}|'
+      sed '${./dbus-system-local.conf.in}' \
+        -e 's,@servicehelper@,${config.security.wrapperDir}/dbus-daemon-launch-helper,g' \
+        -e 's,@extra@,${systemExtraxml},' \
+        > "$out/system-local.conf"
 
-      cp ${pkgs.dbus.daemon}/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}&|' \
-          -e 's|<includedir>session.d</includedir>|${sessionIncludeDirs}|'
-    ''; # */
+      sed '${./dbus-session-local.conf.in}' \
+        -e 's,@extra@,${sessionExtraxml},' \
+        > "$out/session-local.conf"
+    '';
   };
 
-  systemServiceDirs = concatMapStrings
-    (d: "<servicedir>${d}/share/dbus-1/system-services</servicedir> ")
-    cfg.packages;
-
-  systemIncludeDirs = concatMapStrings
-    (d: "<includedir>${d}/etc/dbus-1/system.d</includedir> ")
-    cfg.packages;
-
-  sessionServiceDirs = concatMapStrings
-    (d: "<servicedir>${d}/share/dbus-1/services</servicedir> ")
-    cfg.packages;
-
-  sessionIncludeDirs = concatMapStrings
-    (d: "<includedir>${d}/etc/dbus-1/session.d</includedir> ")
-    cfg.packages;
-
 in
 
 {
@@ -72,7 +52,7 @@ in
 
       enable = mkOption {
         type = types.bool;
-        default = true;
+        default = false;
         internal = true;
         description = ''
           Whether to start the D-Bus message bus daemon, which is
@@ -82,7 +62,7 @@ in
 
       packages = mkOption {
         type = types.listOf types.path;
-        default = [];
+        default = [ ];
         description = ''
           Packages whose D-Bus configuration files should be included in
           the configuration of the D-Bus system-wide message bus.
@@ -129,10 +109,10 @@ in
         permissions = "u+rx,g+rx,o-rx";
       };
 
-    services.dbus.packages =
-      [ "/nix/var/nix/profiles/default"
-        config.system.path
-      ];
+    services.dbus.packages = [
+      pkgs.dbus
+      config.system.path
+    ];
 
     # Don't restart dbus-daemon. Bad things tend to happen if we do.
     systemd.services.dbus.reloadIfChanged = true;