summary refs log tree commit diff
path: root/nixos/modules/services/system/dbus.nix
diff options
context:
space:
mode:
authorNikolay Amiantov <ab@fmap.me>2017-01-31 01:59:20 +0300
committerNikolay Amiantov <ab@fmap.me>2017-02-01 15:03:22 +0300
commit39344a36d318553001f9d738732c9785e8ce054b (patch)
tree4fdeae50b4635d9f0eb3af0fb443b94e7fb1589a /nixos/modules/services/system/dbus.nix
parentbd613c20f42e62dea8681724f6217bb2915e3bdc (diff)
downloadnixpkgs-39344a36d318553001f9d738732c9785e8ce054b.tar
nixpkgs-39344a36d318553001f9d738732c9785e8ce054b.tar.gz
nixpkgs-39344a36d318553001f9d738732c9785e8ce054b.tar.bz2
nixpkgs-39344a36d318553001f9d738732c9785e8ce054b.tar.lz
nixpkgs-39344a36d318553001f9d738732c9785e8ce054b.tar.xz
nixpkgs-39344a36d318553001f9d738732c9785e8ce054b.tar.zst
nixpkgs-39344a36d318553001f9d738732c9785e8ce054b.zip
dbus service: use /etc/dbus-1 for configuration
Also use upstream systemd units.
Diffstat (limited to 'nixos/modules/services/system/dbus.nix')
-rw-r--r--nixos/modules/services/system/dbus.nix22
1 files changed, 8 insertions, 14 deletions
diff --git a/nixos/modules/services/system/dbus.nix b/nixos/modules/services/system/dbus.nix
index bc91d1284a9..6e050fd174e 100644
--- a/nixos/modules/services/system/dbus.nix
+++ b/nixos/modules/services/system/dbus.nix
@@ -20,8 +20,6 @@ let
     "<includedir>${d}/etc/dbus-1/session.d</includedir>"
   ]));
 
-  daemonArgs = "--address=systemd: --nofork --nopidfile --systemd-activation";
-
   configDir = pkgs.runCommand "dbus-conf"
     { preferLocalBuild = true;
       allowSubstitutes = false;
@@ -31,6 +29,9 @@ let
 
       cp ${pkgs.dbus.out}/share/dbus-1/{system,session}.conf $out
 
+      # avoid circular includes
+      sed -ri 's@(<include ignore_missing="yes">/etc/dbus-1/(system|session)\.conf</include>)@<!-- \1 -->@g' $out/{system,session}.conf
+
       # include by full path
       sed -ri "s@/etc/dbus-1/(system|session)-@$out/\1-@" $out/{system,session}.conf
 
@@ -95,6 +96,11 @@ in
 
     environment.systemPackages = [ pkgs.dbus.daemon pkgs.dbus ];
 
+    environment.etc = singleton
+      { source = configDir;
+        target = "dbus-1";
+      };
+
     users.extraUsers.messagebus = {
       uid = config.ids.uids.messagebus;
       description = "D-Bus system message bus daemon user";
@@ -125,10 +131,6 @@ in
       # Don't restart dbus-daemon. Bad things tend to happen if we do.
       reloadIfChanged = true;
       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 = {
@@ -136,18 +138,10 @@ in
         # Don't restart dbus-daemon. Bad things tend to happen if we do.
         reloadIfChanged = true;
         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" ];
     };
 
     environment.pathsToLink = [ "/etc/dbus-1" "/share/dbus-1" ];
-
-    system.extraSystemBuilderCmds = ''
-      ln -s ${configDir} $out/dbus
-    '';
   };
 }