[Nix-dev] comments on -r 31148 "zshprofile to load /etc/profile while emulating bash"
Marc Weber
marco-oweber at gmx.de
Sat Mar 3 03:05:18 CET 2012
For the /etc/profile case I wrote this patch long time ago:
http://mawercer.de/~marc/multi-shell-support.patch
(should apply against nixos, if it does not tell me)
This patch implements
- profile code for both: bash and zsh (only setting up PATH)
- refactor adding "envs" such as ~/.nix-profile
/var/run/current-system/.. to environment so that
you can call simple functions if you want to repeat this
- moves the code enabling completion into a
/etc/zsh-user-system-default.zsh
and
/etc/bash-user-system-default.sh
files which are put into ~/.bashrc and ~/.zshrc by skeleton files
so that users can opt-out or reconfigure completion
- fixes the annoying "NIXOS always resets PATH when starting a zsh/bash
subshell" which is uncommon and very annoying if you want to start a
subshell with augmented env (eg adding ruby/python/haskell/..
libraries) while developing on a project - you may not want to do this
globally for your user always.
I've been using it since then without any issues.
I wrote about it here:
http://article.gmane.org/gmane.linux.distributions.nixos/6511/match=multi+shell+patch
and
http://article.gmane.org/gmane.linux.distributions.nixos/5666/match=multi+shell+patch
So please consider reviewing that old patch before yet someone else tries to fix
zsh for whatever system and yet another reason.
It may just be the better fix for the same problem - because it allows
you to provide zsh/bash/fish/... code for the same problem. There will
always be cases where one code can't be used for all shells.
I've spend about 2 hours trying to understand why my PATH is wrong -
because I use ${FOO} in /etc/profile which must be written as ${=FOO}
for zsh - which broke. Looks like bash emulation is not good enough.
...
There is another chance: symlink zsh to "sh" and run that - then zsh
sources /etc/profile on its own .. But I don't think its a better
solution.
Marc Weber
More information about the nix-dev
mailing list