From 29667f639c8f88b736e8607f36eb713f8b26b6e9 Mon Sep 17 00:00:00 2001 From: Guillaume Maudoux Date: Fri, 27 Jan 2017 14:46:13 +0100 Subject: 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. --- nixos/modules/services/system/dbus.nix | 20 ++++++++------------ 1 file changed, 8 insertions(+), 12 deletions(-) (limited to 'nixos') diff --git a/nixos/modules/services/system/dbus.nix b/nixos/modules/services/system/dbus.nix index a7cf74c15cc5..bc91d1284a9f 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@(/etc/dbus-1/(system|session)\.conf)@@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 + ''; }; } -- cgit 1.4.1