Merge pull request #22343 from abbradar/dbus-etc
dbus service: use /etc/dbus-1 for configuration
This commit is contained in:
commit
c34cfa21d4
@ -20,8 +20,6 @@ let
|
|||||||
"<includedir>${d}/etc/dbus-1/session.d</includedir>"
|
"<includedir>${d}/etc/dbus-1/session.d</includedir>"
|
||||||
]));
|
]));
|
||||||
|
|
||||||
daemonArgs = "--address=systemd: --nofork --nopidfile --systemd-activation";
|
|
||||||
|
|
||||||
configDir = pkgs.runCommand "dbus-conf"
|
configDir = pkgs.runCommand "dbus-conf"
|
||||||
{ preferLocalBuild = true;
|
{ preferLocalBuild = true;
|
||||||
allowSubstitutes = false;
|
allowSubstitutes = false;
|
||||||
@ -29,11 +27,6 @@ let
|
|||||||
''
|
''
|
||||||
mkdir -p $out
|
mkdir -p $out
|
||||||
|
|
||||||
cp ${pkgs.dbus.out}/share/dbus-1/{system,session}.conf $out
|
|
||||||
|
|
||||||
# include by full path
|
|
||||||
sed -ri "s@/etc/dbus-1/(system|session)-@$out/\1-@" $out/{system,session}.conf
|
|
||||||
|
|
||||||
sed '${./dbus-system-local.conf.in}' \
|
sed '${./dbus-system-local.conf.in}' \
|
||||||
-e 's,@servicehelper@,${config.security.wrapperDir}/dbus-daemon-launch-helper,g' \
|
-e 's,@servicehelper@,${config.security.wrapperDir}/dbus-daemon-launch-helper,g' \
|
||||||
-e 's,@extra@,${systemExtraxml},' \
|
-e 's,@extra@,${systemExtraxml},' \
|
||||||
@ -95,6 +88,11 @@ in
|
|||||||
|
|
||||||
environment.systemPackages = [ pkgs.dbus.daemon pkgs.dbus ];
|
environment.systemPackages = [ pkgs.dbus.daemon pkgs.dbus ];
|
||||||
|
|
||||||
|
environment.etc = singleton
|
||||||
|
{ source = configDir;
|
||||||
|
target = "dbus-1";
|
||||||
|
};
|
||||||
|
|
||||||
users.extraUsers.messagebus = {
|
users.extraUsers.messagebus = {
|
||||||
uid = config.ids.uids.messagebus;
|
uid = config.ids.uids.messagebus;
|
||||||
description = "D-Bus system message bus daemon user";
|
description = "D-Bus system message bus daemon user";
|
||||||
@ -125,10 +123,6 @@ in
|
|||||||
# Don't restart dbus-daemon. Bad things tend to happen if we do.
|
# Don't restart dbus-daemon. Bad things tend to happen if we do.
|
||||||
reloadIfChanged = true;
|
reloadIfChanged = true;
|
||||||
restartTriggers = [ configDir ];
|
restartTriggers = [ configDir ];
|
||||||
serviceConfig.ExecStart = [
|
|
||||||
"" # Default dbus.service has two entries, we need to override both.
|
|
||||||
"${lib.getBin pkgs.dbus}/bin/dbus-daemon --config-file=/run/current-system/dbus/system.conf ${daemonArgs}"
|
|
||||||
];
|
|
||||||
};
|
};
|
||||||
|
|
||||||
systemd.user = {
|
systemd.user = {
|
||||||
@ -136,18 +130,10 @@ in
|
|||||||
# Don't restart dbus-daemon. Bad things tend to happen if we do.
|
# Don't restart dbus-daemon. Bad things tend to happen if we do.
|
||||||
reloadIfChanged = true;
|
reloadIfChanged = true;
|
||||||
restartTriggers = [ configDir ];
|
restartTriggers = [ configDir ];
|
||||||
serviceConfig.ExecStart = [
|
|
||||||
"" # Default dbus.service has two entries, we need to override both.
|
|
||||||
"${lib.getBin pkgs.dbus}/bin/dbus-daemon --config-file=/run/current-system/dbus/session.conf ${daemonArgs}"
|
|
||||||
];
|
|
||||||
};
|
};
|
||||||
sockets.dbus.wantedBy = mkIf cfg.socketActivated [ "sockets.target" ];
|
sockets.dbus.wantedBy = mkIf cfg.socketActivated [ "sockets.target" ];
|
||||||
};
|
};
|
||||||
|
|
||||||
environment.pathsToLink = [ "/etc/dbus-1" "/share/dbus-1" ];
|
environment.pathsToLink = [ "/etc/dbus-1" "/share/dbus-1" ];
|
||||||
|
|
||||||
system.extraSystemBuilderCmds = ''
|
|
||||||
ln -s ${configDir} $out/dbus
|
|
||||||
'';
|
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user