From 60b34849284db4aec8f4fdab722273096e1ed002 Mon Sep 17 00:00:00 2001 From: "William A. Kennington III" Date: Sun, 6 Mar 2016 17:38:53 -0800 Subject: dbus: Fix for new 1.10 version (cherry picked from commit 68a4a6df3971d66aa988bba680351a30fbadbed3) --- nixos/modules/services/system/dbus.nix | 68 ++++++++++++---------------------- 1 file changed, 24 insertions(+), 44 deletions(-) (limited to 'nixos/modules/services/system/dbus.nix') 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: [ + "${d}/share/dbus-1/system-services" + "${d}/etc/dbus-1/system.d" + ])); + + sessionExtraxml = concatStrings (flip concatMap cfg.packages (d: [ + "${d}/share/dbus-1/services" + "${d}/etc/dbus-1/session.d" + ])); + 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|.*/libexec/dbus-daemon-launch-helper|${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||${systemServiceDirs}|' \ - -e 's|system.d|${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||${sessionServiceDirs}&|' \ - -e 's|session.d|${sessionIncludeDirs}|' - ''; # */ + sed '${./dbus-session-local.conf.in}' \ + -e 's,@extra@,${sessionExtraxml},' \ + > "$out/session-local.conf" + ''; }; - systemServiceDirs = concatMapStrings - (d: "${d}/share/dbus-1/system-services ") - cfg.packages; - - systemIncludeDirs = concatMapStrings - (d: "${d}/etc/dbus-1/system.d ") - cfg.packages; - - sessionServiceDirs = concatMapStrings - (d: "${d}/share/dbus-1/services ") - cfg.packages; - - sessionIncludeDirs = concatMapStrings - (d: "${d}/etc/dbus-1/session.d ") - 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; -- cgit 1.4.1