summary refs log tree commit diff
path: root/nixos/modules/services/system/dbus.nix
diff options
context:
space:
mode:
authorVladimír Čunát <vcunat@gmail.com>2016-04-10 11:17:52 +0200
committerVladimír Čunát <vcunat@gmail.com>2016-04-10 11:17:52 +0200
commit30f14243c33f1b386273d08a4776aa679c42143d (patch)
treebd123d5c2ab4fef012ae7de6a225c092f8d611b8 /nixos/modules/services/system/dbus.nix
parent50fccad5828fb459760fd7578951bb961a18c0fc (diff)
parent2463e0917318581da94e7ba92703b63128c40424 (diff)
downloadnixpkgs-30f14243c33f1b386273d08a4776aa679c42143d.tar
nixpkgs-30f14243c33f1b386273d08a4776aa679c42143d.tar.gz
nixpkgs-30f14243c33f1b386273d08a4776aa679c42143d.tar.bz2
nixpkgs-30f14243c33f1b386273d08a4776aa679c42143d.tar.lz
nixpkgs-30f14243c33f1b386273d08a4776aa679c42143d.tar.xz
nixpkgs-30f14243c33f1b386273d08a4776aa679c42143d.tar.zst
nixpkgs-30f14243c33f1b386273d08a4776aa679c42143d.zip
Merge branch 'master' into closure-size
Comparison to master evaluations on Hydra:
  - 1255515 for nixos
  - 1255502 for nixpkgs
Diffstat (limited to 'nixos/modules/services/system/dbus.nix')
-rw-r--r--nixos/modules/services/system/dbus.nix24
1 files changed, 24 insertions, 0 deletions
diff --git a/nixos/modules/services/system/dbus.nix b/nixos/modules/services/system/dbus.nix
index 2e29ef6a8f5..32799344304 100644
--- a/nixos/modules/services/system/dbus.nix
+++ b/nixos/modules/services/system/dbus.nix
@@ -139,6 +139,30 @@ in
 
     systemd.services.dbus.restartTriggers = [ configDir ];
 
+    systemd.user = {
+      services.dbus = {
+        description = "D-Bus User Message Bus";
+        requires = [ "dbus.socket" ];
+        # NixOS doesn't support "Also" so we pull it in manually
+        # As the .service is supposed to come up at the same time as
+        # the .socket, we use basic.target instead of default.target
+        wantedBy = [ "basic.target" ];
+        serviceConfig = {
+          ExecStart = "${pkgs.dbus_daemon}/bin/dbus-daemon --session --address=systemd: --nofork --nopidfile --systemd-activation";
+          ExecReload = "${pkgs.dbus_daemon}/bin/dbus-send --print-reply --session --type=method_call --dest=org.freedesktop.DBus / org.freedesktop.DBus.ReloadConfig";
+        };
+      };
+
+      sockets.dbus = {
+        description = "D-Bus User Message Bus Socket";
+        socketConfig = {
+          ListenStream = "%t/bus";
+          ExecStartPost = "-${config.systemd.package}/bin/systemctl --user set-environment DBUS_SESSION_BUS_ADDRESS=unix:path=%t/bus";
+        };
+        wantedBy = [ "sockets.target" ];
+      };
+    };
+
     environment.pathsToLink = [ "/etc/dbus-1" "/share/dbus-1" ];
 
   };