[Nix-dev] nix-multi-user installation script

Andreas Herrmann andreash87 at gmx.ch
Tue Oct 28 22:14:55 CET 2014


Hello everyone,


in the past two weeks or so I have been experimenting with Nix multi-user mode. My goal was to be able to reliably install Nix in multi-user mode on a CentOS 6.5 machine. The result of this was a bash script which pretty much automates the whole process [1]. The script is still a bit rough around the edges, but I got it working repeatedly and reliably on fresh CentOS 6.5 installations.

I would like to ask you guys to have a look at this script and tell me what you think of it. Do you think it could be valuable to add something like this as an automated installer to the official Nix distribution similar to the one for single-user mode?



Unfortunately, CentOS 6.5 comes with fairly old packages. Therefore, it turns out to be next to impossible to compile Nix from sources. (You'd have to compile the rest of the world as well). The Fedora rpm packages can't be used either - for the same reason. So, I ended up using the distribution agnostic binary package of Nix that is also used for the single-user-mode install script. To that I added features necessary for multi-user-mode (daemon, and config), and chroot builds, and some `/etc/profile.d` settings to make Nix easy to use for all users.



I did come up with a few specific questions during the course of this:

 * The nix-daemon is not daemonizing itself. Why is that?
    On debian this is not a problem thanks to `start-stop-daemon`. On CentOS I ended up writing a wrapper script.
 * The chroot build feature seems to require a statically linked bash.
    Compiling this (plus some dependencies) can take quite some time. Do you think a static bash would be a
    viable addition to `nixpkgs`?
 * Is there a way to add globally visible package overrides but still use the nix-channel?
 * Would it be possible to make a non-root user the admin of a multi-user nix installation?
    I.e. a user who can can do `nix-channel --update`. Or does this explicitely require root?



Let me give some credit. I did greatly profit from previous work done by Sander van der Burg [2], on the Nix wiki [3], on the single-user mode install script, and of course on the Nix documentation. Thanks a lot to the corresponding authors.


[1]: https://github.com/aherrmann/nix-multi-user-install
[2]: http://sandervanderburg.blogspot.ch/2013/06/setting-up-multi-user-nix-installation.html
[3]: https://nixos.org/wiki/Installing_Nix_on_Debian


More information about the nix-dev mailing list