[Nix-dev] zsh in NixOS

roconnor at theorem.ca roconnor at theorem.ca
Thu Sep 30 02:29:07 CEST 2010


I was trying to help Twey set up zsh as his shell.

I first suggested that he set users.defaultUserShell to something like 
"${pkgs.zsh}/bin/zsh"; however the NixOS manual says:

``‘This must not be a store path, since the path is used outside the store 
(in particular in /etc/passwd).  Rather, it should be the path of a 
symlink that points to the actual shell in the Nix store.’

I'm not exactly sure why the restriction, but anyhow.

I next suggested setting

environment.systemPackages = [ pkgs.zsh ]
users.defaultUserShell = "/var/run/current-system/sw/bin/zsh"

This kinda works, but the problem is that /etc/bashrc is sourced, and, 
perhaps not surprisingly, this file doesn't work properly when run in zsh.

Twey gets the error mentioned at
<http://www.mail-archive.com/nix-dev@cs.uu.nl/msg02079.html>
pluse some other problems with for loops.

I figure there are two approaches to solving this problem.  Either 
/etc/bashrc needs to be run by bash to set the enviroment variables of 
zsh.  I don't know much about shells, but I was told that this isn't 
possible.  Perhaps what needs to be done is to run /etc/bashrc and have it 
do it's thing (e.g. make ~/.nix-profile directories and whatnot) but 
rather than setting environment variables, it outputs the environment 
variables that need to be set.

The other approach would be to somehow make the work done in /etc/bashrc 
more portable, at least across the bash,zsh,ksh,sh family.

I'm *far* from a shell expert, so someone more knowledgeable probably 
wants to ring in here.

-- 
Russell O'Connor                                      <http://r6.ca/>
``All talk about `theft,''' the general counsel of the American Graphophone
Company wrote, ``is the merest claptrap, for there exists no property in
ideas musical, literary or artistic, except as defined by statute.''


More information about the nix-dev mailing list