Open kira-bruneau opened 2 years ago
This was actually the next thing I wanted to tackle. I'll make a PR but I have to check if the SHELL variable is set and available if the script is run with sh on NixOS
I'm pretty sure something has changed in how NixOS creates users, and I suspect it's related to this issue. In the past, a user.users
setting in configuration.nix
would result in the user's home directory being created and populated with .bash_profile
(among other files) that invokes .bashrc
. That was the case about a year or so ago, when I last built my system from scratch. I have never written a .bash_profile
on any machine/distro I've used, it (and/or .profile) was always already there.
But I rebuilt my system from scratch again this week, and was very confused when I logged into one of the virtual terminals (e.g. Ctrl+Alt+F1) and none of my aliases were recognised. Eventually I discovered that this file wasn't automatically created.
This issue has been mentioned on NixOS Discourse. There might be relevant details there:
https://discourse.nixos.org/t/bash-not-sourcing-bashrc/22859/9
Describe the bug
Currently the xsession wrapper is hard-coded to emulate the login shell for sh.
This should be generalized to load the environment for whatever shell the user configured. Similarly to SDDM's default Xsession wrapper script: https://github.com/sddm/sddm/blob/v0.19.0/data/scripts/Xsession#L8-L51
Decoupling bash-specific sourcing from the xsession wrapper could also make it possible to disable bash again: https://github.com/NixOS/nixpkgs/commit/90dac235bb409e5795aa460b34388c455178035c.
Steps To Reproduce
Steps to reproduce the behavior:
users.users.<name>.shell = bash
~/.bash_profile
file with exports~/.bash_profile
will be sourced in a tty login shell, but not a graphical session.Expected behavior
A graphical session should have the same environment as a tty login for the user's configured shell.
Metadata
Please run
nix-shell -p nix-info --run "nix-info -m"
and paste the result.@LoveIsGrief