Installation Obtaining Nix The easiest way to obtain Nix is to download a source distribution. RPMs for Red Hat 9 are also available. These distributions are generated automatically. Alternatively, the most recent sources of Nix can be obtained from its Subversion repository. For example, the following command will check out the latest revision into a directory called nix: $ svn checkout https://svn.cs.uu.nl:12443/repos/trace/nix/trunk nix Likewise, specific releases can be obtained from the tags directory of the repository. If you don't have Subversion, you can also download an automatically generated compressed tar-file of the head revision of the trunk. Prerequisites The following prerequisites only apply when you build from source. Binary releases (e.g., RPMs) have no prerequisites. A fairly recent version of GCC/G++ is required. Version 2.95 and higher should work. To build this manual and the man-pages you need the xmllint and xsltproc programs, which are part of the libxml2 and libxslt packages, respectively. You also need the DocBook XSL stylesheets and optionally the DocBook XML 4.2 DTD. Note that these are only required if you modify the manual sources or when you are building from the Subversion repository. To build the parser, very recent versions of Bison and Flex are required. (This is because Nix needs GLR support in Bison and reentrancy support in Flex.) For Bison, you need version 1.875c or higher (1.875 does not work), which can be obtained from the GNU FTP server. For Flex, you need version 2.5.31, which is available on SourceForge. Slightly older versions may also work, but ancient versions like the ubiquitous 2.5.4a won't. Note that these are only required if you modify the parser or when you are building from the Subversion repository. Nix uses Sleepycat's Berkeley DB and CWI's ATerm library. These are included in the Nix source distribution. If you build from the Subversion repository, you must download them yourself and place them in the externals/ directory. See externals/Makefile.am for the precise URLs of these packages. Alternatively, if you already have them installed, you can use configure's and options to point to their respective locations. Note that Berkeley DB must be version 4.2; other versions may not have compatible database formats. Building Nix from source After unpacking or checking out the Nix sources, issue the following commands: $ ./configure options... $ make $ make install When building from the Subversion repository, these should be preceded by the command: $ autoreconf -i The installation path can be specified by passing the to configure. The default installation directory is /nix. You can change this to any location you like. You must have write permission to the prefix path. It is advisable not to change the installation prefix from its default, since doing so will in all likelihood make it impossible to use derivations built on other systems. If you want to rebuilt the documentation, pass the full path to the DocBook XML catalog file (docbook.cat) and to the DocBook XSL stylesheets using the and options. Installing from RPMs RPM packages of Nix can be downloaded from . These RPMs should work for most fairly recent releases of SuSE and Red Hat Linux. They have been known to work work on SuSE Linux 8.1 and 9.0, and Red Hat 9.0. In fact, it should work on any RPM-based Linux distribution based on glibc 2.3 or later. Once downloaded, the RPMs can be installed or upgraded using rpm -U. For example, $ rpm -U nix-0.5pre664-1.i386.rpm The RPMs install into the directory /nix. Nix can be uninstalled using rpm -e nix. After this it will be necessary to manually remove the Nix store and other auxiliary data: $ rm -rf /nix/store $ rm -rf /nix/var Permissions All Nix operations must be performed under the user ID that owns the Nix store and database (prefix/store and prefix/var/nix/db, respectively). When installed from the RPM packages, these directories are owned by root. Setuid installation As a somewhat ad hoc hack, you can also install the Nix binaries setuid so that a Nix store can be shared among several users. To do this, configure Nix with the --enable-setuid option. Nix will be installed as owned by a user and group specified by the and options. E.g., $ ./configure --enable-setuid --with-nix-user=my_nix_user --with-nix-group=my_nix_group The user and group default to nix. You should make sure that both the user and the group exist. Any real users that you want to allow access should be added to the Nix group. A setuid installation should only by used if the users in the Nix group are mutually trusted, since any user in that group has the ability to change anything in the Nix store or database. For instance, they could install a trojan horse in executables used by other users. On some platforms, the Nix binaries will be installed as setuid root. They drop root privileges immediately after startup and switch to the Nix user. The reason for this is that both the real and effective user must be set to the Nix user, and POSIX has no system call to do this. This is not the case on systems that have the setresuid() system call (such as Linux and FreeBSD), so on those systems the binaries are simply owned by the Nix user. Using Nix To use Nix, some environment variables should be set. In particular, PATH should contain the directories prefix/bin and ~/.nix-profile/bin. The first directory contains the Nix tools themselves, while ~/.nix-profile is a symbolic link to the current user environment (an automatically generated package consisting of symlinks to installed packages). The simplest way to set the required environment variables is to include the file prefix/etc/profile.d/nix.sh in your ~/.bashrc (or similar), like this: . prefix/etc/profile.d/nix.sh