Merge pull request #97801 from rycee/user-session-dbus2
Make socket activated user dbus session mandatory
This commit is contained in:
commit
4085eee678
8 changed files with 62 additions and 26 deletions
|
@ -1834,6 +1834,19 @@ addEnvHooks "$hostOffset" myBashFunction
|
|||
</para>
|
||||
</listitem>
|
||||
</varlistentry>
|
||||
<varlistentry>
|
||||
<term>
|
||||
<literal>move-systemd-user-units.sh</literal>
|
||||
</term>
|
||||
<listitem>
|
||||
<para>
|
||||
This setup hook moves any systemd user units installed in the lib
|
||||
subdirectory into share. In addition, a link is provided from share to
|
||||
lib for compatibility. This is needed for systemd to find user services
|
||||
when installed into the user profile.
|
||||
</para>
|
||||
</listitem>
|
||||
</varlistentry>
|
||||
<varlistentry>
|
||||
<term>
|
||||
<literal>set-source-date-epoch-to-latest.sh</literal>
|
||||
|
|
|
@ -59,7 +59,15 @@
|
|||
|
||||
<itemizedlist>
|
||||
<listitem>
|
||||
<para />
|
||||
<para>
|
||||
If the <varname>services.dbus</varname> module is enabled, then
|
||||
the user D-Bus session is now always socket activated. The
|
||||
associated options <varname>services.dbus.socketActivated</varname>
|
||||
and <varname>services.xserver.startDbusSession</varname> have
|
||||
therefore been removed and you will receive a warning if
|
||||
they are present in your configuration. This change makes the
|
||||
user D-Bus session available also for non-graphical logins.
|
||||
</para>
|
||||
</listitem>
|
||||
</itemizedlist>
|
||||
</section>
|
||||
|
|
|
@ -142,6 +142,7 @@ in
|
|||
"/share/kservices5"
|
||||
"/share/kservicetypes5"
|
||||
"/share/kxmlgui5"
|
||||
"/share/systemd"
|
||||
];
|
||||
|
||||
system.path = pkgs.buildEnv {
|
||||
|
|
|
@ -19,6 +19,12 @@ in
|
|||
|
||||
{
|
||||
|
||||
imports = [
|
||||
(mkRemovedOptionModule
|
||||
[ "services" "dbus" "socketActivated" ]
|
||||
"The user D-Bus session is now always socket activated and this option can safely be removed.")
|
||||
];
|
||||
|
||||
###### interface
|
||||
|
||||
options = {
|
||||
|
@ -51,14 +57,6 @@ in
|
|||
<filename><replaceable>pkg</replaceable>/share/dbus-1/services</filename>
|
||||
'';
|
||||
};
|
||||
|
||||
socketActivated = mkOption {
|
||||
type = types.bool;
|
||||
default = false;
|
||||
description = ''
|
||||
Make the user instance socket activated.
|
||||
'';
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
|
@ -108,7 +106,7 @@ in
|
|||
reloadIfChanged = true;
|
||||
restartTriggers = [ configDir ];
|
||||
};
|
||||
sockets.dbus.wantedBy = mkIf cfg.socketActivated [ "sockets.target" ];
|
||||
sockets.dbus.wantedBy = [ "sockets.target" ];
|
||||
};
|
||||
|
||||
environment.pathsToLink = [ "/etc/dbus-1" "/share/dbus-1" ];
|
||||
|
|
|
@ -37,13 +37,6 @@ let
|
|||
. /etc/profile
|
||||
cd "$HOME"
|
||||
|
||||
${optionalString cfg.startDbusSession ''
|
||||
if test -z "$DBUS_SESSION_BUS_ADDRESS"; then
|
||||
/run/current-system/systemd/bin/systemctl --user start dbus.socket
|
||||
export `/run/current-system/systemd/bin/systemctl --user show-environment | grep '^DBUS_SESSION_BUS_ADDRESS'`
|
||||
fi
|
||||
''}
|
||||
|
||||
${optionalString cfg.displayManager.job.logToJournal ''
|
||||
if [ -z "$_DID_SYSTEMD_CAT" ]; then
|
||||
export _DID_SYSTEMD_CAT=1
|
||||
|
|
|
@ -151,6 +151,9 @@ in
|
|||
./desktop-managers/default.nix
|
||||
(mkRemovedOptionModule [ "services" "xserver" "startGnuPGAgent" ]
|
||||
"See the 16.09 release notes for more information.")
|
||||
(mkRemovedOptionModule
|
||||
[ "services" "xserver" "startDbusSession" ]
|
||||
"The user D-Bus session is now always socket activated and this option can safely be removed.")
|
||||
];
|
||||
|
||||
|
||||
|
@ -296,14 +299,6 @@ in
|
|||
description = "DPI resolution to use for X server.";
|
||||
};
|
||||
|
||||
startDbusSession = mkOption {
|
||||
type = types.bool;
|
||||
default = true;
|
||||
description = ''
|
||||
Whether to start a new DBus session when you log in with dbus-launch.
|
||||
'';
|
||||
};
|
||||
|
||||
updateDbusEnvironment = mkOption {
|
||||
type = types.bool;
|
||||
default = false;
|
||||
|
|
25
pkgs/build-support/setup-hooks/move-systemd-user-units.sh
Executable file
25
pkgs/build-support/setup-hooks/move-systemd-user-units.sh
Executable file
|
@ -0,0 +1,25 @@
|
|||
#!/usr/bin/env bash
|
||||
|
||||
# This setup hook, for each output, moves everything in
|
||||
# $output/lib/systemd/user to $output/share/systemd/user, and replaces
|
||||
# $output/lib/systemd/user with a symlink to
|
||||
# $output/share/systemd/user.
|
||||
|
||||
fixupOutputHooks+=(_moveSystemdUserUnits)
|
||||
|
||||
_moveSystemdUserUnits() {
|
||||
if [ "${dontMoveSystemdUserUnits:-0}" = 1 ]; then return; fi
|
||||
if [ ! -e "${prefix:?}/lib/systemd/user" ]; then return; fi
|
||||
local source="$prefix/lib/systemd/user"
|
||||
local target="$prefix/share/systemd/user"
|
||||
echo "moving $source/* to $target"
|
||||
mkdir -p "$target"
|
||||
(
|
||||
shopt -s dotglob
|
||||
for i in "$source"/*; do
|
||||
mv "$i" "$target"
|
||||
done
|
||||
)
|
||||
rmdir "$source"
|
||||
ln -s "$target" "$source"
|
||||
}
|
|
@ -61,7 +61,10 @@ let
|
|||
]
|
||||
# FIXME this on Darwin; see
|
||||
# https://github.com/NixOS/nixpkgs/commit/94d164dd7#commitcomment-22030369
|
||||
++ lib.optional hostPlatform.isLinux ../../build-support/setup-hooks/audit-tmpdir.sh
|
||||
++ lib.optionals hostPlatform.isLinux [
|
||||
../../build-support/setup-hooks/audit-tmpdir.sh
|
||||
../../build-support/setup-hooks/move-systemd-user-units.sh
|
||||
]
|
||||
++ [
|
||||
../../build-support/setup-hooks/multiple-outputs.sh
|
||||
../../build-support/setup-hooks/move-sbin.sh
|
||||
|
|
Loading…
Reference in a new issue