[Nix-dev] some basic questions from a new NixOS user

Linus Arver linusarver at gmail.com
Thu Dec 1 06:47:28 CET 2011


On Thu, Dec 01, 2011 at 06:33:08AM +0100, Nicolas Pierron wrote:
> Hi Linus,
> 
> On Thu, Dec 1, 2011 at 03:37, Linus Arver <linusarver at gmail.com> wrote:
> > On Sat, Nov 26, 2011 at 02:42:03PM -0800, Linus Arver wrote:
> >> On Fri, Nov 25, 2011 at 12:35:01AM +0100, Nicolas Pierron wrote:
> >> > Hi Linus,
> >> >
> >> > On Thu, Nov 24, 2011 at 22:44, Linus Arver <linusarver at gmail.com> wrote:
> >> > > On Thu, Nov 24, 2011 at 07:00:29PM +0100, Nicolas Pierron wrote:
> >> > chsh does not work if you reference your user inside NixOS
> >> > configuration file, the reason is that each time you boot, NixOS
> >> > activation script will update /etc/passwd file with the list of users
> >> > and shells.  But you can update your shell inside your
> >> > configuration.nix file.  Have a look at one module of my
> >> > configurations:
> >> >
> >> > https://svn.nixos.org/repos/nix/configurations/trunk/misc/nicolas.b.pierron/common/user.nix
> >>
> >> Thanks for this. I adapted the
> >>
> >>   users.extraUsers = [
> >>     { name = "nicolas";
> >>       uid = 1000;
> >>       group = "users";
> >>       extraGroups = [ "wheel" "share" ];
> >>       description = "Nicolas Pierron";
> >>       home = "/home/nicolas";
> >>       shell = pkgs.zsh + "/bin/zsh";
> >>     }
> >>   ];
> >>
> >>   users.extraGroups = [
> >>     { name = "share";
> >>       gid = 1001;
> >>     }
> >>   ];
> >>
> >>   environment.systemPackages = [
> >>     pkgs.zsh
> >>   ];
> >
> > I just wanted to point out to future zsh users for NixOS that using the
> > above setting will work if you are inside an X process, because the bash
> > shell that runs the X stuff sources /etc/bashrc, /etc/profile for all
> > the right global system PATHs (see
> > /etc/nixos/nixos/modules/programs/bash/bash.nix). But if you log in from
> > a virtual console tty (e.g., CTRL+ALT+F1), or if you SSH in, your zsh
> > won't source the abovementioned files, resulting in an unusable shell.
> 
> What I did on my server was to add the following lines in /etc/zshenv file.
> 
> emulate bash
> alias shopt=false
> . /etc/profile
> unalias shopt
> emulate zsh

Every day, I learn something new. Thanks.

-Linus


More information about the nix-dev mailing list