NixOS

Download

Nix: the package manager

Current version

2.11.1

Linux

Multi-user installation (recommended)

Install Nix via the recommended multi-user installation:

$ sh <(curl -L https://nixos.org/nix/install) --daemon

We recommend the multi-user install if you are on Linux running systemd, with SELinux disabled and you can authenticate with sudo.

Single-user installation

Install Nix via the single-user installation:

$ sh <(curl -L https://nixos.org/nix/install) --no-daemon

Above command will perform a single-user installation of Nix, meaning that /nix is owned by the invoking user. You should run this under your usual user account, not as root. The script will invoke sudo to create /nix if it doesn’t already exist.

Which type of installation should you choose?

This depends on your requirements, but here is a short list of reasons why we recommend multi-user installation:

Pros
  • Better build isolation (and that is what Nix is all about)
  • Better security (a build can not write somewhere in your home)
  • Sharing builds between users
Cons
  • Requires root to run the daemon
  • More involved installation (creation of nixbld* users, installing a systemd unit, ...
  • Harder to uninstall

MacOS

Multi-user installation

Install Nix via the recommended multi-user installation:

$ sh <(curl -L https://nixos.org/nix/install)

We believe we have ironed out how to cleanly support the read-only root on modern macOS. Please consult the manual on details what the installation script does.

Windows (WSL2)

Single-user installation

Install Nix via the single-user installation:

$ sh <(curl -L https://nixos.org/nix/install) --no-daemon

Docker

Start a Docker shell with Nix:

$ docker run -it nixos/nix

Or start a Docker shell with Nix exposing a workdir directory:

$ mkdir workdir
$ docker run -it -v $(pwd)/workdir:/workdir nixos/nix

The workdir example from above can be also used to start hacking on nixpkgs:

$ git clone --depth=1 https://github.com/NixOS/nixpkgs.git
$ docker run -it -v $(pwd)/nixpkgs:/nixpkgs nixos/nix
docker> nix-build -I nixpkgs=/nixpkgs -A hello
docker> find ./result # this symlink points to the build package

Verify installation

Check the installation by opening a new terminal and typing:

$ nix-env --version
nix-env (Nix) 2.3.15

You may want to verify the integrity of the installation script using GPG:

$ curl -o install-nix-2.11.1 https://releases.nixos.org/nix/nix-2.11.1/install
$ curl -o install-nix-2.11.1.asc https://releases.nixos.org/nix/nix-2.11.1/install.asc
$ gpg2 --keyserver hkps://keyserver.ubuntu.com --recv-keys B541D55301270E0BCF15CA5D8170B4726D7198DE
$ gpg2 --verify ./install-nix-2.11.1.asc
$ sh ./install-nix-2.11.1

The signing key has fingerprint B541 D553 0127 0E0B CF15 CA5D 8170 B472 6D71 98DE. It is also available on GitHub.

NixOS: the Linux distribution

Current version

22.05

ISO image

You can install NixOS on physical hardware by burning one of the CD images onto a blank CD/DVD disk, or by copying it onto a USB stick. For installation instructions, please see the manual.

Graphical ISO image

The graphical installation ISO image contains the graphical NixOS installer as well as a Desktop Environment and several applications. It’s a live CD, so it allows you to get an impression of NixOS (and the Nix package manager) without installing it.

Note that while the image itself only comes in GNOME and Plasma variations, the included installer also allows installing various other desktops, or installing without a desktop.

Minimal ISO image

The minimal installation ISO image does not contain the graphical user interface, and is therefore a lot smaller. You have to run the installer from the console. It contains a number of rescue tools.

VirtualBox

VirtualBox image includes the Plasma Desktop (was KDE) as well as the VirtualBox guest additions.

To use it

  • Download the OVA file using the button above.
  • Open VirtualBox.
  • Run File → Import Appliance from the menu.
  • Select previously downloaded OVA file.
  • Click Import.
  • You can then start the virtual machine.
  • You can log in as user demo, password demo.
  • To obtain a root shell, run sudo -i in the terminal (konsole).

Amazon EC2

NixOS can be deployed to Amazon EC2 with a pre-generated AMI image that you can select bellow.

Via AWS Management Console

You can create an instance using the AWS Management Console by selecting the region and clicking the Launch button.

Choose region:
Root storage Virtualisation AMI
EBS Hardware ami-0d3a6166c1ea4d7b4
EBS Hardware ami-06445325c360470d8
EBS Hardware ami-009c422293bcf3721
EBS Hardware ami-0bfc0397525a67ed8
EBS Hardware ami-0a1fb4d4e08a6065e
EBS Hardware ami-07ad258dcc69239d2
EBS Hardware ami-0f59f7f33cba8b1a4
EBS Hardware ami-0d1e49fe30aec165d
EBS Hardware ami-0f5cb24a1e3fc62dd
EBS Hardware ami-0551a595ba7916462
EBS Hardware ami-0702eee2e75d541d1
EBS Hardware ami-0fc6838942cb7d9cb
EBS Hardware ami-0df9463b8965cdb80
EBS Hardware ami-00badba5cfa0a0c0d
EBS Hardware ami-08f3c1eb533a42ac1
EBS Hardware ami-04b50c79dc4009c97
EBS Hardware ami-05c52087afab7024d
EBS Hardware ami-0732aa0f0c28f281b
EBS Hardware ami-0223db08811f6fb2d
EBS Hardware ami-0a743534fa3e51b41
EBS Hardware ami-0d72ab697beab5ea5
EBS Hardware ami-034946f0c47088751

Via Command Line

You can also create an instance from the command line. For example, to create an instance in region eu-west-1 using the EC2 API tools, just run:

$ nix-shell -p ec2_api_tools
(nix-shell) $ ec2-run-instances ami-00badba5cfa0a0c0d --region eu-west-1 -k my-key-pair