diff --git a/nixos/modules/services/system/dbus-session-local.conf.in b/nixos/modules/services/system/dbus-session-local.conf.in new file mode 100644 index 000000000000..5fd6f80a3539 --- /dev/null +++ b/nixos/modules/services/system/dbus-session-local.conf.in @@ -0,0 +1,5 @@ + + + @extra@ + diff --git a/nixos/modules/services/system/dbus-system-local.conf.in b/nixos/modules/services/system/dbus-system-local.conf.in new file mode 100644 index 000000000000..edbb476f585a --- /dev/null +++ b/nixos/modules/services/system/dbus-system-local.conf.in @@ -0,0 +1,6 @@ + + + @servicehelper@ + @extra@ + diff --git a/nixos/modules/services/system/dbus.nix b/nixos/modules/services/system/dbus.nix index 59c2e482e1ad..434211aaac41 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 + 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" - # !!! 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}|' - - 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; diff --git a/nixos/modules/system/boot/systemd.nix b/nixos/modules/system/boot/systemd.nix index 3f497566ff11..e7f892945315 100644 --- a/nixos/modules/system/boot/systemd.nix +++ b/nixos/modules/system/boot/systemd.nix @@ -689,6 +689,8 @@ in "systemd/system-generators" = { source = generators; }; }); + services.dbus.enable = true; + system.activationScripts.systemd = stringAfter [ "groups" ] '' mkdir -m 0755 -p /var/lib/udev diff --git a/pkgs/development/libraries/dbus/default.nix b/pkgs/development/libraries/dbus/default.nix index 83635d9739f1..dd86ca540815 100644 --- a/pkgs/development/libraries/dbus/default.nix +++ b/pkgs/development/libraries/dbus/default.nix @@ -6,8 +6,8 @@ assert x11Support -> libX11 != null && libSM != null; let - version = "1.8.20"; - sha256 = "0fkh3d5r57a659hw9lqnw4v0bc5556vx54fsf7l9c732ci6byksw"; + version = "1.10.8"; + sha256 = "0560y3hxpgh346w6avcrcz79c8ansmn771y5xpcvvlr6m8mx5wxs"; self = stdenv.mkDerivation { name = "dbus-${version}"; @@ -17,8 +17,7 @@ self = stdenv.mkDerivation { inherit sha256; }; - patches = [ ./ignore-missing-includedirs.patch ] - ++ lib.optional stdenv.isSunOS ./implement-getgrouplist.patch; + patches = lib.optional stdenv.isSunOS ./implement-getgrouplist.patch; postPatch = '' substituteInPlace tools/Makefile.in \ --replace 'install-localstatelibDATA:' 'disabled:' \ diff --git a/pkgs/development/libraries/dbus/ignore-missing-includedirs.patch b/pkgs/development/libraries/dbus/ignore-missing-includedirs.patch deleted file mode 100644 index 2781f4ae3de5..000000000000 --- a/pkgs/development/libraries/dbus/ignore-missing-includedirs.patch +++ /dev/null @@ -1,23 +0,0 @@ -diff -ru -x '*~' dbus-1.2.24-orig/bus/config-parser.c dbus-1.2.24/bus/config-parser.c ---- dbus-1.2.24-orig/bus/config-parser.c 2010-03-23 20:01:27.000000000 +0100 -+++ dbus-1.2.24/bus/config-parser.c 2010-07-20 14:17:20.000000000 +0200 -@@ -2159,12 +2159,16 @@ - - retval = FALSE; - -- dir = _dbus_directory_open (dirname, error); -+ dbus_error_init (&tmp_error); -+ -+ dir = _dbus_directory_open (dirname, &tmp_error); - - if (dir == NULL) -- goto failed; -+ { -+ retval = TRUE; -+ goto failed; -+ } - -- dbus_error_init (&tmp_error); - while (_dbus_directory_get_next_file (dir, &filename, &tmp_error)) - { - DBusString full_path;