Install Nix

Linux

Install Nix via the recommended multi-user installation:

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

Note

For security you may want to verify the installation script using GPG signatures.

macOS

Install Nix via the recommended multi-user installation:

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

Note

For security you may want to verify the installation script using GPG signatures.

Windows (WSL2)

Install Nix via the recommended single-user installation:

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

Note

For security you may want to verify the installation script using GPG signatures.

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 [email protected]:NixOS/nixpkgs
$ docker run -it -v $(pwd)/nixpkgs:/nixpkgs nixos/nix
bash-5.1# nix-build -I nixpkgs=/nixpkgs -A hello
bash-5.1# find ./result # this symlink points to the build package

Verify installation

Check the installation by opening a new terminal and typing:

$ nix --version
nix (Nix) 2.11.0