Skip to content

Commit

Permalink
support dbus-broker
Browse files Browse the repository at this point in the history
  • Loading branch information
peterhoeg committed Feb 22, 2018
1 parent 8b1cf10 commit 6353f46
Showing 1 changed file with 25 additions and 5 deletions.
30 changes: 25 additions & 5 deletions nixos/modules/services/system/dbus.nix
Expand Up @@ -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.
'';
};
};
};

Expand All @@ -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";
Expand All @@ -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" ];
};

Expand Down

0 comments on commit 6353f46

Please sign in to comment.