New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
nixos/xonsh: source NixOS environment #84330
Conversation
This pull request has been mentioned on NixOS Discourse. There might be relevant details there: https://discourse.nixos.org/t/can-i-use-xonsh-as-my-login-shell-if-so-how/6472/8 |
This pull request has been mentioned on NixOS Discourse. There might be relevant details there: https://discourse.nixos.org/t/prs-ready-for-review-may-2019/3032/142 |
f581c64
to
57a56af
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It looks good: I can log in, startx
works, the environment seems ok.
There is only one issue I noticed: the warning about aliases (only ls
for me) beign ignored because they would override a xonsh built-in alias. I'm not sure which option between ignoring with --suppress-skip-message
or overwriting with --overwrite-alias
is better but the warning is pretty annoying if you are using this as your daily shell.
Without doing that, xonsh is unusable as login shell
57a56af
to
347e251
Compare
Xonsh doesn't distinguish between aliases and its builtin functions:>>> aliases
xonsh.aliases.Aliases(
{'EOF': <function xonsh.aliases.xonsh_exit>,
'bg': <function xonsh.jobs.bg>,
'cd': <function xonsh.dirstack.cd>,
'completer': <function xonsh.completers._aliases.completer_alias>,
'dirs': <function xonsh.dirstack.dirs>,
'egrep': ['egrep', '--color=auto'],
'exec': <function xonsh.aliases.xexec>,
'exit': <function xonsh.aliases.xonsh_exit>,
'fg': <function xonsh.jobs.fg>,
'fgrep': ['fgrep', '--color=auto'],
'grep': ['grep', '--color=auto'],
'history': <function xonsh.history.main.history_main>,
'ipynb': ['jupyter', 'notebook', '--no-browser'],
'jobs': <function xonsh.jobs.jobs>,
'popd': <function xonsh.dirstack.popd>,
'pushd': <function xonsh.dirstack.pushd>,
'quit': <function xonsh.aliases.xonsh_exit>,
'replay': <function xonsh.replay.replay_main>,
'scp-resume': ['rsync', '--partial', '-h', '--progress', '--rsh=ssh'],
'showcmd': <function xonsh.aliases.showcmd>,
'source': <function xonsh.aliases.source_alias>,
'source-bash': ['source-foreign', 'bash', '--sourcer=source'],
'source-cmd': <function xonsh.aliases.source_cmd>,
'source-foreign': <function xonsh.aliases.source_foreign>,
'source-zsh': ['source-foreign', 'zsh', '--sourcer=source'],
'timeit': <function xonsh.timings.timeit_alias>,
'trace': <function xonsh.aliases.trace>,
'which': <function xonsh.xoreutils.which.which>,
'xexec': <function xonsh.aliases.xexec>,
'xonfig': <function xonsh.aliases.xonfig>,
'xonsh-reset': <function xonsh.aliases.xonsh_reset>,
'xontrib': <function xonsh.xontribs.xontribs_main>,
'xpip': ['sudo',
'/nix/store/ljbn79cwlwvrlmqil0nk4zvf043ph592-python3-3.7.5/bin/python3.7',
'-m',
'pip']}) Therefore, I'm reluctant to On the other hand, Thus I think we should gracefully handle the known alias collision(s), but have that warning message appear again for unexpected collisions. For an otherwise default configuration, Xonsh sets |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It sounds like a good idea. The only problem is that if new aliases were to be addded to NixOS the list will have to be update manually, however environment.shellAliases
doesn't change often so I guess it's all right.
If you have no objections I'm going to merge this: it's already an improvement over the current state of xonsh. |
Me? Despite my warning in the PR description, I have no objections to merging this, or I would have filed it as WIP PR instead of regular PR. The warning is just there to manage expectations. 😉
That's my take, too, @rnhmjoj. Let's ship it! Should it be backported to 20.03 or would that be too surprising a change? |
Good, let's do it.
Uhm, I'm not too keen on backporting non-bugfix changes after the feature-freeze. It should probably be safe but it may have some unintended consequences... |
Tried it on Dunno what was up when I tried it on release-19.09 |
@das-g I was down the same adventure as you yesterday. I've successfully managed to make xonsh my login shell in TTY, but SDDM->KDE fails. I also had to configure wrap xonsh in a shell script to set XDG_CONFIG_HOME set before launching it, else it'd fail finding RC files. Are you still running xonsh as your login shell? |
Yes, I am, @Lillecarl. But quite some stuff doesn't work as I'd expect in my setup, e.g. there's no command completion for Git subcommands and their arguments and options. PRs welcome! |
@das-g https://github.com/Lillecarl/nixos/blob/master/lillecarl/dotfiles/.config/xonsh/rc.xsh#L41 Not sure if that's related to your issue, but for me adding bash completion support from current-system worked out just great, I have bash-completions for git, and a lot of other tools. |
Without doing that, xonsh is unusable as login shell.
users.users.<name?>.shell
toxonsh
for my user prevents me from successfully logging into GNOME 3 from GDM (and maybe prevents any graphical login - didn't test with other login managers or DEs / WMs, yet). But at least I get a usable xonsh shell in text mode (virtual terminal accessible with Ctrl-Alt-F1 etc.), which I didn't get without this change. (Without the change, xonsh would start on login, but would be nearly unusable as almost all external commands would have to be invoked through their absolute path, because they wouldn't be on$PATH
.)Motivation for this change
If a shell can be allowed as an interactive login shell (and NixOS option
programs.xonsh.enable
does that, if I understand correctly), it should be usable as a login shell, and logging into it should yield that shell in a usable state.Things done
sandbox
innix.conf
on non-NixOS linux)nix run nixpkgs.nixpkgs-review -c nixpkgs-review pr 84330
./result/bin/
)nix path-info -S
before and after)Result of
nixpkgs-review pr 84330
1[empty]