nixos/xsession: use graphical systemd user target#26094
Conversation
c81b3b5 to
bf99837
Compare
|
Is there a reason that this couldn't be Also, if you're looking for more test cases, the |
|
FWIW both redshift and unclutter service (patched locally in the same way as redshift in this PR) are working for me on lightdm / xmonad setup. |
nixos/modules/programs/gnupg.nix
Outdated
There was a problem hiding this comment.
Is DBUS_SESSION_BUS_ADDRESS also inherited by default? pinentry-gtk-2 needs that.
There was a problem hiding this comment.
otherwise passing --systemd to dbus-update-activation-environment might be a good idea: https://dbus.freedesktop.org/doc/dbus-update-activation-environment.1.html or using systemctl --user import-environment
There was a problem hiding this comment.
Doesn't seem like it:
$ systemctl --user status redshift.service | grep PID
Main PID: 5762 (redshift)
$ cat /proc/5762/environ | awk -v 'RS=\0' '{ print $0 }' | grep DBUS
There was a problem hiding this comment.
pinentry-gtk-2 works for me in X. :) I've removed the PassEnvironment because it's not needed anymore. (GPG_TTY is picked up by gpg).
|
|
16067d2 to
d3615e0
Compare
|
I've fixed the gnupg agent module to find the correct terminal every time for gpg invocations, even if logged in in different terminals. Unfortunately, this doesn't always work for SSH but we can't fix that because it's a missing feature in the SSH agent protocol. Only use one tty or |
|
Oh, and the module is using the upstream gpg-agent units now, so we have socket activation if SSH is not enabled! 🍻 |
I wanted to use a different target name because we would have to override some options and the semantics of the unit would slightly change. My guess is that no package is currently shipping systemd units with
Here is a talk about |
78d661d to
b7069cc
Compare
|
Oh, and there is also documentation about Pondering about it some more, I think we should indeed override |
|
oh, did not know it was already a standard. |
|
Okay, now using Will squash and fix commit description before merging. I'm also in the process of converting and testing all remaining user services that depend on X. |
|
All remaining services I could identify are fixed. Another highlight: We now have a working socket-activated pulseaudio user service. ;) |
While systemd suggests using the pre-defined graphical-session user target, I found that this interface is difficult to use. Additionally, no other major distribution, even in their unstable versions, currently use this mechanism. The window or desktop manager is supposed to run in a systemd user service which activates graphical-session.target and the user services that are binding to this target. The issue is that we can't elegantly pass the xsession environment to the window manager session, in particular whereas the PassEnvironment option does work for DISPLAY, it for some mysterious reason won't for PATH. This commit implements a new graphical user target that works just like default.target. Services which should be run in a graphical session just need to declare wantedBy graphical.target. The graphical target will be activated in the xsession before executing the window or display manager. Fixes NixOS#17858.
Creates a systemd user service and updates the tty on new logins so that gpg-agent may find the current tty even if the SSH agent mode is used.
ea92510 to
04158d9
Compare
Motivation for this change
While systemd suggests using the pre-defined graphical-session user
target, I found that this interface is difficult to use. Additionally,
no other major distribution, even in their unstable versions, currently
use this mechanism.
The window or desktop manager is supposed to run in a systemd user service
which activates graphical-session.target and the user services that are
binding to this target. The issue is that we can't elegantly pass the
xsession environment to the window manager session, in particular
whereas the PassEnvironment option does work for DISPLAY, it for some
mysterious reason won't for PATH.
This commit implements a new graphical user target that works just like
default.target. Services which should be run in a graphical session just
need to declare wantedBy graphical.target. The graphical target will be
activated in the xsession before executing the window or display manager.
Fixes #17858.
Things done
Only tested with i3 and slim right now but will test other window and desktop managers before merging.