Skip to content
Permalink

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also or learn more about diff comparisons.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also . Learn more about diff comparisons here.
base repository: NixOS/nixpkgs
Failed to load repositories. Confirm that selected base ref is valid, then try again.
Loading
base: ff7e38b9542a
Choose a base ref
...
head repository: NixOS/nixpkgs
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: e044909abaaa
Choose a head ref
  • 2 commits
  • 2 files changed
  • 3 contributors

Commits on Sep 5, 2020

  1. nixos/displayManager: add XDG_SESSION_ID to systemd user environment

    xss-lock needs XDG_SESSION_ID to respond to loginctl lock-session(s)
    (and possibly other session operations such as idle hint management).
    This change adds XDG_SESSION_ID to the list of imported environment
    variables when starting systemctl.
    
    Inspired by home-manager, add importVariables configuration.
    
    Set session to XDG_SESSION_ID when running xss-lock as a service.
    
    Co-authored-by: misuzu <bakalolka@gmail.com>
    evenbrenden and misuzu committed Sep 5, 2020
    Copy the full SHA
    660882d View commit details

Commits on Sep 9, 2020

  1. Merge pull request #93764 from evenbrenden/xdg-session-id-user-units

    nixos/displayManager: add XDG_SESSION_ID to systemd user environment
    worldofpeace authored Sep 9, 2020
    Copy the full SHA
    e044909 View commit details
Showing with 25 additions and 8 deletions.
  1. +1 −1 nixos/modules/programs/xss-lock.nix
  2. +24 −7 nixos/modules/services/x11/display-managers/default.nix
2 changes: 1 addition & 1 deletion nixos/modules/programs/xss-lock.nix
Original file line number Diff line number Diff line change
@@ -34,7 +34,7 @@ in
partOf = [ "graphical-session.target" ];
serviceConfig.ExecStart = with lib;
strings.concatStringsSep " " ([
"${pkgs.xss-lock}/bin/xss-lock"
"${pkgs.xss-lock}/bin/xss-lock" "--session \${XDG_SESSION_ID}"
] ++ (map escapeShellArg cfg.extraOptions) ++ [
"--"
cfg.lockerCommand
31 changes: 24 additions & 7 deletions nixos/modules/services/x11/display-managers/default.nix
Original file line number Diff line number Diff line change
@@ -55,13 +55,6 @@ let
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.
${xorg.xrdb}/bin/xrdb -merge ${xresourcesXft}
if test -e ~/.Xresources; then
@@ -70,6 +63,12 @@ let
${xorg.xrdb}/bin/xrdb -merge ~/.Xdefaults
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
# http://kdemonkey.blogspot.nl/2008/04/magic-trick.html
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 = {

preStart = mkOption {
@@ -393,6 +400,16 @@ in

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 = {
unitConfig = {
RefuseManualStart = false;