From 39344a36d318553001f9d738732c9785e8ce054b Mon Sep 17 00:00:00 2001 From: Nikolay Amiantov Date: Tue, 31 Jan 2017 01:59:20 +0300 Subject: dbus service: use /etc/dbus-1 for configuration Also use upstream systemd units. --- nixos/modules/services/system/dbus.nix | 22 ++++++++-------------- 1 file changed, 8 insertions(+), 14 deletions(-) (limited to 'nixos/modules/services/system') diff --git a/nixos/modules/services/system/dbus.nix b/nixos/modules/services/system/dbus.nix index bc91d1284a9f..6e050fd174ea 100644 --- a/nixos/modules/services/system/dbus.nix +++ b/nixos/modules/services/system/dbus.nix @@ -20,8 +20,6 @@ let "${d}/etc/dbus-1/session.d" ])); - 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@(/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 @@ -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 - ''; }; } -- cgit 1.4.1 From 72b37462668e3a7568d94632994a9df5d7fd37eb Mon Sep 17 00:00:00 2001 From: Nikolay Amiantov Date: Wed, 1 Feb 2017 15:37:20 +0300 Subject: dbus service: remove {system,session}.conf from config dir They are already included by dbus from /run/current-system/sw/share/dbus-1. --- nixos/modules/services/system/dbus.nix | 8 -------- 1 file changed, 8 deletions(-) (limited to 'nixos/modules/services/system') diff --git a/nixos/modules/services/system/dbus.nix b/nixos/modules/services/system/dbus.nix index 6e050fd174ea..aeb5bf9c7a36 100644 --- a/nixos/modules/services/system/dbus.nix +++ b/nixos/modules/services/system/dbus.nix @@ -27,14 +27,6 @@ let '' mkdir -p $out - 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 - sed '${./dbus-system-local.conf.in}' \ -e 's,@servicehelper@,${config.security.wrapperDir}/dbus-daemon-launch-helper,g' \ -e 's,@extra@,${systemExtraxml},' \ -- cgit 1.4.1