(i.e., users.users.das-g.shell = pkgs.xonsh; is now set)
I applied these changes with
sudo nixos-rebuild boot
to a new system generation
I rebootet into the new system generation
The result was, that the graphical session (GNOME 3 in my case) wouldn’t work anymore. The login screen came up with the entry for my user and all, but if I selected that, entered my password and logged in, I would almost immediately be returned to the login screen, without anything from GNOME showing up.
So I switched to a virtual terminal with Ctrl+Alt+F1. There, I could log in and indeed xonsh was being used. But even basic commands like echo weren’t available and the content of $PATH (which xonsh can fortunately display without relying on echo) looked suspiciously short for a NixOS session: Maybe four or five entries, only.
Was I doing anything wrong and/or missing something? Or is the xonsh derivation not prepared to be used as a login shell? (Should it be, though?) Or is xonsh per se unsuited as a login shell?
The existence of the NixOS option programs.xonsh.enable makes be believe that xonsh is intended to be usable as a login shell on NixOS and that I’ve either missed some step or the package is faulty or incomplete. (Without knowing much about it, I guess it needs some additional wrapper or something.)
The path to the user’s shell. Can use shell derivations, like pkgs.bashInteractive . Don’t forget to enable your shell in programs if necessary, like programs.zsh.enable = true; .
(emphasis by me)
And indeed, if I don’t overwrite it in /etc/nixos/configuration.nix, nixos-option users.users.das-g.shell reports the value to be /nix/store/lb3hli8d9536g45mndwfwyi6fpny0blh-bash-interactive-4.4-p23, which is also just a directory.
Alas, that leads to the exact same behavior as just shell = pkgs.xonsh; did.
Shouldn’t the login then not have worked at all? Note that I did get a xonsh session, albeit not a very usable one.
You are right, I made a couple tests and it’s indeed not necessary.
Setting the shell for a user also works without adding the shell to /etc/shells, which is what programs.xonsh.enable et al. do. The Linux programmer’s manual says it’s mainly needed by chsh and some program to check if you are a real user.
Looking at how fish works it seems xonsh is not sourcing the NixOS environment, which would explain the absence of PATH and other variables. It’s not POSIX compatible, so I don’t know how it works, but you would have to add the equivalent of:
# source the NixOS environment config
if [ -z "$__NIXOS_SET_ENVIRONMENT_DONE" ]