[Nix-dev] comments on -r 31148 "zshprofile to load /etc/profile while emulating bash"

Mathijs Kwik mathijs at bluescreen303.nl
Sat Mar 3 07:12:05 CET 2012


What would be the steps to take for nixos to include this patch?

Are there any issues or breakage that would occur?
Any upgrade problems for people with a somewhat modified .bashrc ?

I've been running with zsh since I came to nix by just bootstapping
zsh from .bashrc because I couldn't figure out an easier/better way.
I would love to remove that dirty hack and just trunst nixos to setup
the environment without depending on bash.

Mathijs

On Sat, Mar 3, 2012 at 3:05 AM, Marc Weber <marco-oweber at gmx.de> wrote:
> 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
> _______________________________________________
> nix-dev mailing list
> nix-dev at lists.science.uu.nl
> http://lists.science.uu.nl/mailman/listinfo/nix-dev


More information about the nix-dev mailing list