Conversation
|
Even though it works perfectly well for me only for login shells, I changed it to interactive shells just in case. I think running shell in graphical environment often will not be a login shell. But It should be a responsibility of the graphical environment to load env vars. With |
|
IIUC, the issue you deal with is the slowdown of setting env vars at shell initialization caused by Your approach is to only set those env vars for interactive or login shells, which may cause those env vars not being set when needed, e.g. non-login and interactive shells started by gnome-terminal and non-login and non-interactive shells for running commands through ssh as described in my related pr for zsh. I propose a better approach: replace |
|
Thank you for your contribution! I marked this pull request as stale due to inactivity. Please read the relevant sections below before commenting. If you are the original author of the PR
If you are not the original author of the PR
|
|
Since #4012, I think this can be closed. |
|
OK, then. |
Description
Unlike bash fish executes all commands from
config.fish. Bash executes.bash_profileor.profilefor login shells and.bashrcfor interactive shells. In my opinion environment variables should be set only for login shells. Simplefishcommand shouldn't change global variables likePATH. Right now in bashhm-session-vars.shis sourced in.profile(login shells). Also it is sourced in.bashrc, but only whentargets.genericLinux.enableis enabled:home-manager/modules/targets/generic-linux.nix
Lines 66 to 71 in cbacdab
The linked comment mentions a tmux issue, but it's not the case at least for modern tmux: in tmux by default shell is a login shell.
If you are wary that it won't be sourced in some cases, we can change condition to
status is-interactiveinstead.I'm pretty sure that one of the conditions (is-login or is-interactive) are desirable, because commands like
fish -c '<something>'should be as quick as possible, because many tools may need to run some shell commands and they are using$SHELLvariable for it. Right now in home-managerfish -c exitis pretty slow (30 ms vs 8 ms for me) because fenv is slow (it runs external commands like bash/sed/tr multiple times).Checklist
Change is backwards compatible.
Code formatted with
./format.Code tested through
nix-shell --pure tests -A run.all.Test cases updated/added. See example.
Commit messages are formatted like
See CONTRIBUTING for more information and recent commit messages for examples.
If this PR adds a new module
Added myself as module maintainer. See example.
Added myself and the module files to
.github/CODEOWNERS.