Merge pull request #309068 from SuperSandro2000/dbus-broker

nixos/dbus: fix switching from dbus-broker to dbus
This commit is contained in:
Florian Klink 2024-05-05 21:32:53 +03:00 committed by GitHub
commit 135fbd12c3
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 15 additions and 0 deletions

View File

@ -147,6 +147,10 @@ in
};
systemd.services.dbus = {
aliases = [
# hack aiding to prevent dbus from restarting when switching from dbus-broker back to dbus
"dbus-broker.service"
];
# Don't restart dbus-daemon. Bad things tend to happen if we do.
reloadIfChanged = true;
restartTriggers = [
@ -158,6 +162,10 @@ in
};
systemd.user.services.dbus = {
aliases = [
# hack aiding to prevent dbus from restarting when switching from dbus-broker back to dbus
"dbus-broker.service"
];
# Don't restart dbus-daemon. Bad things tend to happen if we do.
reloadIfChanged = true;
restartTriggers = [
@ -184,6 +192,8 @@ in
# https://github.com/NixOS/nixpkgs/issues/108643
systemd.services.dbus-broker = {
aliases = [
# allow other services to just depend on dbus,
# but also a hack aiding to prevent dbus from restarting when switching from dbus-broker back to dbus
"dbus.service"
];
unitConfig = {
@ -203,6 +213,8 @@ in
systemd.user.services.dbus-broker = {
aliases = [
# allow other services to just depend on dbus,
# but also a hack aiding to prevent dbus from restarting when switching from dbus-broker back to dbus
"dbus.service"
];
# Don't restart dbus. Bad things tend to happen if we do.

View File

@ -472,6 +472,9 @@ sub handle_modified_unit { ## no critic(Subroutines::ProhibitManyArgs, Subroutin
$units_to_reload->{$unit} = 1;
record_unit($reload_list_file, $unit);
}
elsif ($unit eq "dbus.service" || $unit eq "dbus-broker.service") {
# dbus service should only ever be reloaded, not started/stoped/restarted as that would break the system.
}
elsif (!parse_systemd_bool(\%new_unit_info, "Service", "X-RestartIfChanged", 1) || parse_systemd_bool(\%new_unit_info, "Unit", "RefuseManualStop", 0) || parse_systemd_bool(\%new_unit_info, "Unit", "X-OnlyManualStart", 0)) {
$units_to_skip->{$unit} = 1;
} else {