summary refs log tree commit diff
path: root/nixos/modules/services/system/dbus.nix
diff options
context:
space:
mode:
authorGuillaume Maudoux <layus.on@gmail.com>2017-01-27 14:46:13 +0100
committerFranz Pletz <fpletz@fnordicwalking.de>2017-01-27 14:46:13 +0100
commit29667f639c8f88b736e8607f36eb713f8b26b6e9 (patch)
tree528d0a8cca2acf01b281b7c65bac65c47ef7998c /nixos/modules/services/system/dbus.nix
parentda1cd49747bb83ac41f49a58b3b7a2624be551cd (diff)
downloadnixpkgs-29667f639c8f88b736e8607f36eb713f8b26b6e9.tar
nixpkgs-29667f639c8f88b736e8607f36eb713f8b26b6e9.tar.gz
nixpkgs-29667f639c8f88b736e8607f36eb713f8b26b6e9.tar.bz2
nixpkgs-29667f639c8f88b736e8607f36eb713f8b26b6e9.tar.lz
nixpkgs-29667f639c8f88b736e8607f36eb713f8b26b6e9.tar.xz
nixpkgs-29667f639c8f88b736e8607f36eb713f8b26b6e9.tar.zst
nixpkgs-29667f639c8f88b736e8607f36eb713f8b26b6e9.zip
dbus: catch new services without reboot (#20871)
DBus daemon now loads its config from /run/current-system/dbus.
Reloading the daemon makes it re-read that file and catch the updates
after a system upgrade.
Diffstat (limited to 'nixos/modules/services/system/dbus.nix')
-rw-r--r--nixos/modules/services/system/dbus.nix20
1 files changed, 8 insertions, 12 deletions
diff --git a/nixos/modules/services/system/dbus.nix b/nixos/modules/services/system/dbus.nix
index a7cf74c15cc..bc91d1284a9 100644
--- a/nixos/modules/services/system/dbus.nix
+++ b/nixos/modules/services/system/dbus.nix
@@ -31,9 +31,6 @@ 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
 
@@ -98,11 +95,6 @@ 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";
@@ -134,8 +126,8 @@ in
       reloadIfChanged = true;
       restartTriggers = [ configDir ];
       serviceConfig.ExecStart = [
-        ""
-        "${lib.getBin pkgs.dbus}/bin/dbus-daemon --config-file=${configDir}/system.conf ${daemonArgs}"
+        "" # 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}"
       ];
     };
 
@@ -145,13 +137,17 @@ in
         reloadIfChanged = true;
         restartTriggers = [ configDir ];
         serviceConfig.ExecStart = [
-          ""
-          "${lib.getBin pkgs.dbus}/bin/dbus-daemon --config-file=${configDir}/session.conf ${daemonArgs}"
+          "" # 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
+    '';
   };
 }