diff --git a/nixos/modules/services/system/dbus-session-local.conf.in b/nixos/modules/services/system/dbus-session-local.conf.in
deleted file mode 100644
index 5fd6f80a3539..000000000000
--- a/nixos/modules/services/system/dbus-session-local.conf.in
+++ /dev/null
@@ -1,5 +0,0 @@
-
-
- @extra@
-
diff --git a/nixos/modules/services/system/dbus-system-local.conf.in b/nixos/modules/services/system/dbus-system-local.conf.in
deleted file mode 100644
index edbb476f585a..000000000000
--- a/nixos/modules/services/system/dbus-system-local.conf.in
+++ /dev/null
@@ -1,6 +0,0 @@
-
-
- @servicehelper@
- @extra@
-
diff --git a/nixos/modules/services/system/dbus.nix b/nixos/modules/services/system/dbus.nix
index 33bc890a78c8..643bec188142 100644
--- a/nixos/modules/services/system/dbus.nix
+++ b/nixos/modules/services/system/dbus.nix
@@ -10,32 +10,10 @@ let
homeDir = "/run/dbus";
- systemExtraxml = concatStrings (flip concatMap cfg.packages (d: [
- "${d}/share/dbus-1/system-services"
- "${d}/etc/dbus-1/system.d"
- ]));
-
- sessionExtraxml = concatStrings (flip concatMap cfg.packages (d: [
- "${d}/share/dbus-1/services"
- "${d}/etc/dbus-1/session.d"
- ]));
-
- configDir = pkgs.runCommand "dbus-conf"
- { preferLocalBuild = true;
- allowSubstitutes = false;
- }
- ''
- mkdir -p $out
-
- sed '${./dbus-system-local.conf.in}' \
- -e 's,@servicehelper@,${config.security.wrapperDir}/dbus-daemon-launch-helper,g' \
- -e 's,@extra@,${systemExtraxml},' \
- > "$out/system-local.conf"
-
- sed '${./dbus-session-local.conf.in}' \
- -e 's,@extra@,${sessionExtraxml},' \
- > "$out/session-local.conf"
- '';
+ configDir = pkgs.makeDBusConf {
+ suidHelper = "${config.security.wrapperDir}/dbus-daemon-launch-helper";
+ serviceDirectories = cfg.packages;
+ };
in