Hi Linus, On Thu, Nov 24, 2011 at 22:44, Linus Arver <linusar...@gmail.com> wrote: > On Thu, Nov 24, 2011 at 07:00:29PM +0100, Nicolas Pierron wrote: >> Hi Linus, >> >> On Thu, Nov 24, 2011 at 07:24, Linus Arver <linusar...@gmail.com> wrote: >> > I'm new to this list. >> >> Great. >> >> > 1a. I've added a new user account with "useradd," per the manual, and >> > have done a couple installations of software with `nix-env -i'. This is >> > great, but I'm curious --- what is the preferred way to install >> > software? The wiki page at http://nixos.org/wiki/Install/remove_software >> > says that there are two ways to install software --- system-wide (by >> > editing environment.systemPackages), and per-user (by just doing nix-env >> > -i [package]). My understanding is that in order to get the advertised >> > advantages of NixOS's rollback functionality, you have to do system-wide >> > installs because the whole "nixos-rebuild" command only looks at >> > /etc/nixos/configuration.nix. I.e., there is no way to rollback the >> > system on a per-user basis. So, do most people on here have a very long >> > environment.systemPackages definition in their configuration.nix, >> > defining all system-wide packages? >> >> Using either per-user install or system-wide install depends on what >> you want to do. Personally I use both. >> >> NixOS is build on top of Nix and relies on the nix-env command to >> update the system profile and also to do rollbacks (have a look at the >> end of nix-env man page). One advantage of per-user profiles is that >> the root account does not see (in its default PATH) the user installed >> software and also the opposite. This difference is not a big security >> protection but it helps to separate the administrative tools from the >> commonly used tools. >> >> On my case, I am using user profiles to install software that I don't >> want to see under the root user (inkscape, gimp, firefox, …) and I am >> also using user-profiles (not the default ~/.nix-profile) to test >> compilation with different tool-chains (x64-gcc45, x86-gcc46, …), in >> which case I reset the environment and rebuild it from scratch with >> only this user profile. >> > > Thanks, this cleared up a lot of things. I just learned from reading the > Nix manual that you can create new profiles by just doing > > nix-env --switch-profile /nix/var/nix/profiles/foo > > and it will create "foo" if it doesn't exist already. I'm having trouble > understanding the hierarchy of folders/files in the profiles folder, > though. For my system, there appear to be 3 distinct profiles > > 1. /nix/var/nix/profiles/default (3 generations) > 2. /nix/var/nix/profiles/system (7 generations) > 3. /nix/var/nix/profiles/per-user/l/profile (11 generations) > 4. /nix/var/nix/profiles/per-user/root (no files) > > I can tell that #3 is what I'm currently using (if I do "nix-env > --list-generations" I get 11 generatios). If I do a "su" to change into > root and then do "nix-env --list-generations" I get 3 generations, so > that would correspond to #1. So my question is --- why does #4 exist? Is > it to house new, custom-created profiles for the root user? Perhaps > these different profiles should be documented in the Nix manual...
And easier way to find your current profile is to use $ ls -l ~/.nix-profile >> > 1b. If I wanted zsh, git, and rxvt-unicode to be available system-wide, >> > can I do: >> > >> > environment.systemPackages = [ >> > pkgs.zsh >> > pkgs.git >> > pkgs.rxvt-unicode >> > ]; >> > >> > in my configuration.nix? There does not seem to be any documentation >> > regarding the syntax for this. >> >> Sure, you can do it, except that the papckages names are extracted >> from /etc/nixos/nixpkgs/pkgs/top-level/all-packages.nix . Thus you >> should not use the package name, but the key listed in this file. So >> you will need to replace >> >> > pkgs.rxvt-unicode >> >> by pkgs.rxvt_unicode >> > > Thanks, that makes sense --- I was getting errors with the former form. > Is the path > "/etc/nixos/nixpkgs/pkgs/top-level/all-packages.nix" documented > somewhere so I can learn more about it? Not directly, but multiple reference are made to it in Nixpkgs documentation. http://nixos.org/nixpkgs/docs.html >> > 2. If I do "nix-env -i" as the root user, then the installation is only >> > for the root user, correct? >> >> I am no longer sure since I haven't reinstalled NixOS since a while, >> but I think you have a default profile which is used by all users >> including root. So you may want to switch to another profile such as >> $NIX_USER_PROFILE_DIR . > > I don't understand --- I thought switching profiles is done with the > "nix-env --switch-profile" command? It is, but you can manualy change to another profile if the current link is not what you want. > My original question was formulated > when I did not have a good idea about profiles --- and maybe it doesn't > make much sense in light of my discoveries above regarding > /nix/var/nix/profiles. As a user (root or l), when you type "nix-env" command, it will update the profile which is pointed by the symbolic link ~/.nix-profile --- unless you used the "-p" option. The profile /nix/var/nix/profiles/default is loaded by all users inside /etc/bashrc script. So if any user update the default profile, the modification would be visible by all. >> Don't hesitate to give us your feedback if you think that some steps >> are not clear and took you time to figure out. I'll update the wiki >> page to fix one mistake and to separate the uninstall from the >> removal. > > Thanks! The biggest problem for me is the lack of practical > documentation --- right now the NixOS docs are concerned more about the > technical advantages of NixOS and do not really help actual users trying > out the system. Of course, this will improve as more users install > NixOS, but it's the same chicken-and-egg problem that all Linux distros > have to face. > > Anyway, my #1 goal right now is to get Xmonad installed and started on > boot. I don't want to bother with logging in manually with SLIM --- I > just want to stare at a blank rxvt-unicode terminal from Xmonad when I > start up. In my Arch Linux boxes, I have a /etc/inittab which deals with > how all of this is handled (automatic logging in, startx, etc.), but I'm > not so sure how to translate this setup into NixOS. In NixOS, you have to set options inside your /etc/nixos/configuration.nix file. Based on your goals I guess you will be interested by the following list of options: # enable Xmonad services.xserver.windowManager.xmonad.enable # Automatic logging services.xserver.displayManager.auto.enable services.xserver.displayManager.auto.user To start rxvt, I recommend you to copy the /etc/nixos/nixos/modules/services/x11/desktop-managers/xterm.nix nix expression and adapt it to your shell, and enable it inside your configuration. This module start XTerm at the beginning of the session. > My #2 goal is to get firefox installed. Right now if I do "nix-env -i > firefox", it fails because install_flash_player_10_linux.tar.gz cannot > be downloaded from any mirror. Maybe this is only affecting i686 > platforms. In the mean time you can change the options to avoid installing the flash player. You can copy the following into ~/.nixpkgs/config.nix . This file would be loaded by all-packages.nix. { firefox = { enableAdobeFlash = false; }; } > Curiously, zsh does not give me any problems in this regard. It's not > really a problem for me, because I use zsh whenever possible (and will > set it to my login shell as soon as I figure out chsh for my regular > user...) 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 -- Nicolas Pierron http://www.linkedin.com/in/nicolasbpierron - http://nbp.name/ _______________________________________________ nix-dev mailing list nix-dev@lists.science.uu.nl http://lists.science.uu.nl/mailman/listinfo/nix-dev