2020-05-20 11:16:30 -04:00
|
|
|
.. _install-nix:
|
|
|
|
|
2020-05-18 04:52:41 -04:00
|
|
|
Install Nix
|
|
|
|
===========
|
|
|
|
|
2020-05-19 06:34:39 -04:00
|
|
|
Install Nix on **any Linux distribution**, **MacOS** and **Windows (via WSL)**
|
2020-11-18 07:35:11 -05:00
|
|
|
via the recommended `multi-user installation <https://nixos.org/manual/nix/stable/#chap-installation>`_:
|
2020-05-18 04:52:41 -04:00
|
|
|
|
2020-05-18 05:41:12 -04:00
|
|
|
.. code:: bash
|
2020-05-18 04:52:41 -04:00
|
|
|
|
2020-05-19 06:34:39 -04:00
|
|
|
sh <(curl -L https://nixos.org/nix/install) --daemon
|
2020-05-18 04:52:41 -04:00
|
|
|
|
2020-06-21 08:26:51 -04:00
|
|
|
.. note::
|
2020-05-18 04:52:41 -04:00
|
|
|
|
2020-12-09 23:56:18 -05:00
|
|
|
For security you may want to `verify the installation script`_ using GPG signatures.
|
2020-05-18 04:52:41 -04:00
|
|
|
|
2020-05-19 06:34:39 -04:00
|
|
|
Verify installation
|
|
|
|
-------------------
|
|
|
|
|
|
|
|
Check that the installation was successful:
|
2020-05-18 04:52:41 -04:00
|
|
|
|
2020-05-19 06:34:39 -04:00
|
|
|
.. code:: bash
|
2020-05-18 04:52:41 -04:00
|
|
|
|
2020-05-19 06:34:39 -04:00
|
|
|
$ nix-env --version
|
2020-06-18 04:36:42 -04:00
|
|
|
nix-env (Nix) 2.3.6
|
2020-05-18 04:52:41 -04:00
|
|
|
|
2020-12-09 23:56:18 -05:00
|
|
|
.. _verify the installation script: https://nixos.org/download.html#nix-verify-installation
|
2021-07-21 16:14:06 -04:00
|
|
|
|
|
|
|
Use Docker to explore Nix
|
|
|
|
-------------------------
|
|
|
|
|
|
|
|
Start a Docker shell with Nix:
|
|
|
|
|
|
|
|
.. code:: bash
|
|
|
|
|
|
|
|
$ docker run -it nixos/nix
|
|
|
|
|
|
|
|
Or start a Docker shell with Nix exposing a work directory:
|
|
|
|
|
|
|
|
.. code:: bash
|
|
|
|
|
|
|
|
$ mkdir workdir
|
|
|
|
$ docker run -it -v $(pwd)/workdir:/workdir nixos/nix
|
|
|
|
|