Installation
Supported platforms Nix is currently supported on the following platforms: Linux (particularly on x86, x86_64, and PowerPC). Mac OS X, both on Intel and PowerPC. FreeBSD (only tested on Intel). Windows through Cygwin. On Cygwin, Nix must be installed on an NTFS partition. It will not work correctly on a FAT partition. Nix is pretty portable, so it should work on most other Unix platforms as well.
Obtaining Nix The easiest way to obtain Nix is to download a source distribution. RPMs for Red Hat, SuSE, and Fedora Core are also available. 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 5.0 RELAX NG schemas. 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 2.3 or higher (1.875 does not work), which can be obtained from the GNU FTP server. For Flex, you need version 2.5.33, 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.5; 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: $ ./boostrap 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 best not to change the installation prefix from its default, since doing so makes it impossible to use pre-built binaries from the standard Nixpkgs channels. If you want to rebuilt the documentation, pass the full path to the DocBook RELAX NG schemas and to the DocBook XSL stylesheets using the and options.
Installing from RPMs RPM packages of Nix can be downloaded from http://www.cs.uu.nl/groups/ST/Trace/Nix. 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
Upgrading Nix through Nix You can install the latest stable version of Nix through Nix itself by subscribing to the channel , or the latest unstable version by subscribing to the channel. You can also do a one-click installation by clicking on the package links at .
Security Nix has two basic security models. First, it can be used in “single-user mode”, which is similar to what most other package management tools do: there is a single user (typically root) who performs all package management operations. All other users can then use the installed packages, but they cannot perform package management operations themselves. Alternatively, you can configure Nix in “multi-user mode”. In this model, all users can perform package management operations — for instance, every user can install software without requiring root privileges. Nix ensures that this is secure. For instance, it’s not possible for one user to overwrite a package used by another user with a Trojan horse.
Single-user mode In single-user mode, all Nix operations that access the database in prefix/var/nix/db or modify the Nix store in prefix/store must be performed under the user ID that owns those directories. This is typically root. (If you install from RPM packages, that’s in fact the default ownership.) However, on single-user machines, it is often convenient to chown those directories to your normal user account so that you don’t have to su to root all the time.
Multi-user mode Multi-user mode has one important limitation: only root can run nix-pull to register the availability of pre-built binaries. However, those registrations are used by all users to speed up builds.
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: source prefix/etc/profile.d/nix.sh