Replies: 2 comments 4 replies
|
This is probably better off as a discussion as it is not actively an issue, nor do we know if there will be adverse consequences if we change this |
|
Since NixOS configurations are being shared in that thread, here is what I came up with, as an alternative to the initial workaround (systemd drop-in) I proposed in the description:
The environment of the Niri session (Wayland) is now free of the Bash garbage. |
Uh oh!
There was an error while loading. Please reload this page.
Description
The
niri-sessionstartup script imports the entirety of the login manager's environment into systemd, so that it becomes available to theniri.serviceunit (and other user services).It would be a good idea to sanitize the session's environment by excluding a few of these environment variables, similarly to how
uwsmdoes, mainly to avoid issues with subshells spawned by terminal emulators inside Niri.Demonstration
Here is what the process tree looks like after starting Niri via
niri-session, from a greeter likegreetd:If we look at the environment of the process
/bin/sh /bin/niri-session -l(5143), we see thatSHLVLequals0(expected and desired):However, somewhere inside the
niri-sessionscript,/bin/sh's environment gets exported, which means that variables such asSHLVL,SHELL,TERMorPWDare also exported inside the environment of the Wayland session.If we look at the environment of the process
systemctl --user --wait start niri.service(5186), we see thatSHLVLnow equals1(undesired):Expectedly, the same thing can be observed in the environment of the user's process
/bin/niri --session(5187):Workaround
The environment can be sanitized by editing the
niri.serviceuser unit, for instance via a drop-in:systemctl --user edit niri.serviceI would suggest to either:
UnsetEnvironmentdirectives by default insideniri.service.systemctl --user import-environmentwithout any argument (which is deprecated and prints a warning).systemctl --user unset-environment SHLVL SHELL TERM PWDafterimport-environment.System Information
All reactions