@@ -20,8 +20,6 @@ let
2020 "<includedir>${d}/etc/dbus-1/session.d</includedir>"
2121 ]));
2222
23− daemonArgs = "--address=systemd: --nofork --nopidfile --systemd-activation";
24−
2523 configDir = pkgs.runCommand "dbus-conf"
2624 { preferLocalBuild = true;
2725 allowSubstitutes = false;
@@ -31,6 +29,9 @@ let
3129
3230 cp ${pkgs.dbus.out}/share/dbus-1/{system,session}.conf $out
3331
32+ # avoid circular includes
33+ sed -ri 's@(<include ignore_missing="yes">/etc/dbus-1/(system|session)\.conf</include>)@<!-- \1 -->@g' $out/{system,session}.conf
34+
3435 # include by full path
3536 sed -ri "s@/etc/dbus-1/(system|session)-@$out/\1-@" $out/{system,session}.conf
3637
@@ -95,6 +96,11 @@ in
9596
9697 environment.systemPackages = [ pkgs.dbus.daemon pkgs.dbus ];
9798
99+ environment.etc = singleton
100+ { source = configDir;
101+ target = "dbus-1";
102+ };
103+
98104 users.extraUsers.messagebus = {
99105 uid = config.ids.uids.messagebus;
100106 description = "D-Bus system message bus daemon user";
@@ -125,10 +131,6 @@ in
125131 # Don't restart dbus-daemon. Bad things tend to happen if we do.
126132 reloadIfChanged = true;
127133 restartTriggers = [ configDir ];
128− serviceConfig.ExecStart = [
129− "" # Default dbus.service has two entries, we need to override both.
130− "${lib.getBin pkgs.dbus}/bin/dbus-daemon --config-file=/run/current-system/dbus/system.conf ${daemonArgs}"
131− ];
132134 };
133135
134136 systemd.user = {
@@ -136,18 +138,10 @@ in
136138 # Don't restart dbus-daemon. Bad things tend to happen if we do.
137139 reloadIfChanged = true;
138140 restartTriggers = [ configDir ];
139− serviceConfig.ExecStart = [
140− "" # Default dbus.service has two entries, we need to override both.
141− "${lib.getBin pkgs.dbus}/bin/dbus-daemon --config-file=/run/current-system/dbus/session.conf ${daemonArgs}"
142− ];
143141 };
144142 sockets.dbus.wantedBy = mkIf cfg.socketActivated [ "sockets.target" ];
145143 };
146144
147145 environment.pathsToLink = [ "/etc/dbus-1" "/share/dbus-1" ];
148−
149− system.extraSystemBuilderCmds = ''
150− ln -s ${configDir} $out/dbus
151− '';
152146 };
153147}