Open schuelermine opened 2 years ago
I've been debugging this a bit and the culprit for my case (no access to coreutils in fishline plugin) is https://github.com/nix-community/home-manager/pull/3031. I'm not sure what the right solution is to this. @oxalica thoughts?
edit: maybe I'm wrong... I use greetd and Sway, so this may not be the cause for you.
I've been debugging this a bit and the culprit for my case (no access to coreutils in fishline plugin) is https://github.com/nix-community/home-manager/pull/3031
Seems unrelated to this one. But generally systemd environment is unrelated to session environment. The former is for isolated systemd services (no env vars, by default), and the latter is for user interaction (PATH
, EDITOR
, LESS
and etc).
@schuelermine
Could you try switching to bash
as login shell? My friends also have some env var issues with fish
as login shell.
I tried to recreate the problem but I couldn’t.
Same problem with SDDM and Sway, any ideas?
Thank you for your contribution! I marked this issue as stale due to inactivity. Please be considerate of people watching this issue and receiving notifications before commenting 'I have this issue too'. We welcome additional information that will help resolve this issue. Please read the relevant sections below before commenting.
* If this is resolved, please consider closing it so that the maintainers know not to focus on this. * If this might still be an issue, but you are not interested in promoting its resolution, please consider closing it while encouraging others to take over and reopen an issue if they care enough. * If you know how to solve the issue, please consider submitting a Pull Request that addresses this issue.
* If you are also experiencing this issue, please add details of your situation to help with the debugging process. * If you know how to solve the issue, please consider submitting a Pull Request that addresses this issue.
Don't be afraid to manually close an issue, even if it holds valuable information. Closed issues stay in the system for people to search, read, cross-reference, or even reopen – nothing is lost! Closing obsolete issues is an important way to help maintainers focus their time and effort.
I think I'm experiencing the same issue.
I am using sway and foot (in server mode), and start sway with [[ "$(tty)" == /dev/tty1 ]] && sway
in ~/.profile
. ssh-agent and such stopped working in terminal sessions after switching to 22.11.
The problem is fixed for a particular terminal session when I source ~/.profile
which eventually sources /etc/profiles/per-user/$USER/etc/profile.d/hm-session-vars.sh
.
Prior to #3031, sway was importing all of those variables to systemd and so these variables were available to each terminal session.
I think this could be fixed by sourcing hm-session-vars.sh
from .bashrc
or something, but is that the proper way to fix this?
I don't know much about how systemd env vars affect each session, but I tested running systemctl --user import-environment something
, restarting systemctl --user restart foot.service
, and the something
variable was set in the terminal session.
Same problem here, When logging into Wayland, I can read all environment variables in bash
(such as EDITOR
SSH_AUTH_SOCK
), but nothing in nushell.
Since my bash shell works fine, currently I fixed this problem by running nushell via bash: https://github.com/ryan4yin/nix-config/pull/27
I have the same problem with wayland (gnome) and zsh (with xorg everything works fine). I made some research, /etc/profiles/per-user/samu/etc/profile.d/hm-session-vars.sh
is sourced in .zshenv
, I checked and .zshenv
is executed every time, and so is hm-session-vars.sh
. But the variables aren't set, I think that the if [ -n "$__HM_SESS_VARS_SOURCED" ]; then return; fi
at the beginning of hm-session-vars.sh
is triggered, but why? $__HM_SESS_VARS_SOURCED
should be empty in a new session (and it is with xorg), but with wayland something is different, I don't know why.
Sourcing hm-session-vars.sh
in .zshrc
or something is not a solution anyway (for me).
Edit: I have to reboot the system in order to update them.
I have a similar problem with nested shells when using vscode remote ssh. My understanding is that it spawns its server process through SSH using bash or some other shell, invokes the global /etc/profiles/per-user/$USER/etc/profile.d/hm-session-vars.sh
which exports __HM_SESS_VARS_SOURCED=1
. Then, when I use the integrated terminal, it spawns a subprocess with fish as my shell of choice.
Fish then runs part of the initialisation, but Home Manager's init scripts are checking __HM_SESS_VARS_SOURCED
first , while /etc/set-environment
only sets, but does not check for __NIXOS_SET_ENVIRONMENT_DONE=1
. In effect, those coarse variables defined through config.environment.variables
, like the mkDefault EDITOR=nano
are overwriting my home-manager specific ones.
I think that either HM should align with NixOS and remove the branch, or we should have a similar branch in /etc/set-environment
so it won't set things twice in nested shells.
Hi, I have had the same problem using SDDM for a long time now and have followed this issue. Yesterday I found this issue which explained that there's something different in SDDM 0.20.0 (currently NixOS unstable) than 0.19.0 (NixOS 23.05).
After creating an overlay which uses the unstable package in my configuration it now correctly loads the env variables! I'm not quite sure what exactly is happening as for my eyes it should also work with the implementation from 0.19.0 but I'm happy that I've found a fix/workaround for the time being.
This seems to be a duplicate of https://github.com/nix-community/home-manager/issues/2659
Is there an existing issue for this?
Issue description
When setting a session variable such as $EDITOR via
home.sessionVariables
, the variables are loaded in Xorg, but not in Wayland.I am choosing the session via GDM.
My terminal is kitty.
My shell is nushell.
My home-manager configuration: https://github.com/schuelermine/home-manager-configuration
I have since switched to
systemd.user.sessionVariables
. The last commit to usehome.sessionVariables
is 557de379dd0eb144cae5833efc2ad22d43b875bc.My system configuration: https://github.com/schuelermine/nixos-configuration
Maintainer CC
No response
System information