Skip to content
Permalink
Browse files

support dbus-broker

  • Loading branch information
peterhoeg committed Feb 22, 2018
1 parent 8b1cf10 commit 6353f467c9b35542004ae7f623e8d871bf45589e
Showing with 25 additions and 5 deletions.
  1. +25 −5 nixos/modules/services/system/dbus.nix
@@ -57,6 +57,14 @@ in
Make the user instance socket activated.
'';
};

preferBroker = mkOption {
type = types.bool;
default = false;
description = ''
Use dbus-broker instead of the legacy dbus daemon.
'';
};
};
};

@@ -80,7 +88,9 @@ in

users.extraGroups.messagebus.gid = config.ids.gids.messagebus;

systemd.packages = [ pkgs.dbus.daemon ];
systemd.packages = [
pkgs.dbus.daemon
] ++ lib.optional cfg.preferBroker pkgs.dbus-broker;

security.wrappers.dbus-daemon-launch-helper = {
source = "${pkgs.dbus.daemon}/libexec/dbus-daemon-launch-helper";
@@ -96,18 +106,28 @@ in
config.system.path
];

systemd.services.dbus = {
# Don't restart dbus-daemon. Bad things tend to happen if we do.
reloadIfChanged = true;
restartTriggers = [ configDir ];
systemd.services = {
dbus = {
enable = !cfg.preferBroker;
# Don't restart dbus-daemon. Bad things tend to happen if we do.
reloadIfChanged = true;
restartTriggers = [ configDir ];
};
dbus-broker = lib.mkIf cfg.preferBroker {
aliases = [ "dbus.service" ];
};
};

systemd.user = {
services.dbus = {
enable = !cfg.preferBroker;
# Don't restart dbus-daemon. Bad things tend to happen if we do.
reloadIfChanged = true;
restartTriggers = [ configDir ];
};
services.dbus-broker = lib.mkIf cfg.preferBroker {
aliases = [ "dbus.service" ];
};
sockets.dbus.wantedBy = mkIf cfg.socketActivated [ "sockets.target" ];
};

0 comments on commit 6353f46

Please sign in to comment.
You can’t perform that action at this time.