mirror of
https://github.com/SebastianWendel/nixpkgs.git
synced 2024-09-21 12:59:04 +02:00
Merge pull request #93764 from evenbrenden/xdg-session-id-user-units
nixos/displayManager: add XDG_SESSION_ID to systemd user environment
This commit is contained in:
commit
e044909aba
|
@ -34,7 +34,7 @@ in
|
||||||
partOf = [ "graphical-session.target" ];
|
partOf = [ "graphical-session.target" ];
|
||||||
serviceConfig.ExecStart = with lib;
|
serviceConfig.ExecStart = with lib;
|
||||||
strings.concatStringsSep " " ([
|
strings.concatStringsSep " " ([
|
||||||
"${pkgs.xss-lock}/bin/xss-lock"
|
"${pkgs.xss-lock}/bin/xss-lock" "--session \${XDG_SESSION_ID}"
|
||||||
] ++ (map escapeShellArg cfg.extraOptions) ++ [
|
] ++ (map escapeShellArg cfg.extraOptions) ++ [
|
||||||
"--"
|
"--"
|
||||||
cfg.lockerCommand
|
cfg.lockerCommand
|
||||||
|
|
|
@ -55,13 +55,6 @@ let
|
||||||
exec &> >(tee ~/.xsession-errors)
|
exec &> >(tee ~/.xsession-errors)
|
||||||
''}
|
''}
|
||||||
|
|
||||||
# Tell systemd about our $DISPLAY and $XAUTHORITY.
|
|
||||||
# This is needed by the ssh-agent unit.
|
|
||||||
#
|
|
||||||
# Also tell systemd about the dbus session bus address.
|
|
||||||
# This is required by user units using the session bus.
|
|
||||||
/run/current-system/systemd/bin/systemctl --user import-environment DISPLAY XAUTHORITY DBUS_SESSION_BUS_ADDRESS
|
|
||||||
|
|
||||||
# Load X defaults. This should probably be safe on wayland too.
|
# Load X defaults. This should probably be safe on wayland too.
|
||||||
${xorg.xrdb}/bin/xrdb -merge ${xresourcesXft}
|
${xorg.xrdb}/bin/xrdb -merge ${xresourcesXft}
|
||||||
if test -e ~/.Xresources; then
|
if test -e ~/.Xresources; then
|
||||||
|
@ -70,6 +63,12 @@ let
|
||||||
${xorg.xrdb}/bin/xrdb -merge ~/.Xdefaults
|
${xorg.xrdb}/bin/xrdb -merge ~/.Xdefaults
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
# Import environment variables into the systemd user environment.
|
||||||
|
${optionalString (cfg.displayManager.importedVariables != []) (
|
||||||
|
"/run/current-system/systemd/bin/systemctl --user import-environment "
|
||||||
|
+ toString (unique cfg.displayManager.importedVariables)
|
||||||
|
)}
|
||||||
|
|
||||||
# Speed up application start by 50-150ms according to
|
# Speed up application start by 50-150ms according to
|
||||||
# http://kdemonkey.blogspot.nl/2008/04/magic-trick.html
|
# http://kdemonkey.blogspot.nl/2008/04/magic-trick.html
|
||||||
rm -rf "$HOME/.compose-cache"
|
rm -rf "$HOME/.compose-cache"
|
||||||
|
@ -289,6 +288,14 @@ in
|
||||||
'';
|
'';
|
||||||
};
|
};
|
||||||
|
|
||||||
|
importedVariables = mkOption {
|
||||||
|
type = types.listOf (types.strMatching "[a-zA-Z_][a-zA-Z0-9_]*");
|
||||||
|
visible = false;
|
||||||
|
description = ''
|
||||||
|
Environment variables to import into the systemd user environment.
|
||||||
|
'';
|
||||||
|
};
|
||||||
|
|
||||||
job = {
|
job = {
|
||||||
|
|
||||||
preStart = mkOption {
|
preStart = mkOption {
|
||||||
|
@ -393,6 +400,16 @@ in
|
||||||
|
|
||||||
services.xserver.displayManager.xserverBin = "${xorg.xorgserver.out}/bin/X";
|
services.xserver.displayManager.xserverBin = "${xorg.xorgserver.out}/bin/X";
|
||||||
|
|
||||||
|
services.xserver.displayManager.importedVariables = [
|
||||||
|
# This is required by user units using the session bus.
|
||||||
|
"DBUS_SESSION_BUS_ADDRESS"
|
||||||
|
# These are needed by the ssh-agent unit.
|
||||||
|
"DISPLAY"
|
||||||
|
"XAUTHORITY"
|
||||||
|
# This is required to specify session within user units (e.g. loginctl lock-session).
|
||||||
|
"XDG_SESSION_ID"
|
||||||
|
];
|
||||||
|
|
||||||
systemd.user.targets.graphical-session = {
|
systemd.user.targets.graphical-session = {
|
||||||
unitConfig = {
|
unitConfig = {
|
||||||
RefuseManualStart = false;
|
RefuseManualStart = false;
|
||||||
|
|
Loading…
Reference in a new issue