Nix Installation Guide: Difference between revisions
imported>DavHau No edit summary |
imported>Doronbehar Remove now uneeded NFS patch with sqlite-wal |
||
Line 3: | Line 3: | ||
== Single-user install == | == Single-user install == | ||
To install Nix from any Linux distribution, use the following two commands. (Note: This assumes you have the permission to use <code>sudo</code>, and you are logged in as the user you want to install Nix for.) | === Stable Nix === | ||
To install stable Nix from any Linux distribution, use the following two commands. (Note: This assumes you have the permission to use <code>sudo</code>, and you are logged in as the user you want to install Nix for.) | |||
<syntaxHighlight lang="console"> | <syntaxHighlight lang="console"> | ||
Line 19: | Line 21: | ||
After that being done, you can use all Nix commands as a normal user without any special permissions (for example by using <code>sudo</code>). | After that being done, you can use all Nix commands as a normal user without any special permissions (for example by using <code>sudo</code>). | ||
==== User namespaces ==== | ==== Troubleshooting ==== | ||
===== User namespaces ===== | |||
If the installation fails with the following error: | If the installation fails with the following error: | ||
<pre> | <pre> | ||
Line 29: | Line 33: | ||
enabled by default on Linux which requires user namespaces. | enabled by default on Linux which requires user namespaces. | ||
If possible enable them; the procedure depends on the distribution. In last resort, you can disable the sandbox: create the file <code>~/.config/nix/nix.conf</code> and include the line <code>sandbox = false</code>. | If possible enable them; the procedure depends on the distribution. In last resort, you can disable the sandbox: create the file <code>~/.config/nix/nix.conf</code> and include the line <code>sandbox = false</code>. | ||
=== Unstable Nix === | |||
To install unstable Nix with flakes support, you can use the [https://github.com/numtide/nix-unstable-installer unofficial installer by @numtide]. Instructions are available in the README of the repository. | |||
== Nix store on an unusual filesystem == | == Nix store on an unusual filesystem == | ||
=== Case insensitive filesystem on Linux === | === Case insensitive filesystem on Linux === | ||
Most Linux filesystems are case sensitive. If your nix store is on a case insensitive filesystem like CIFS on Linux, derivation outputs cannot contain two files differing only in case in the same directory. Nix can work around this by adding <code>use-case-hack = true</code> to your nix configuration (<code>/etc/nix/nix.conf</code> for a multi-user-install or <code>~/.config/nix/nix.conf</code> otherwise). Unfortunately, this will change the hash of some derivations and thus make the binary cache useless. | Most Linux filesystems are case sensitive. If your nix store is on a case insensitive filesystem like CIFS on Linux, derivation outputs cannot contain two files differing only in case in the same directory. Nix can work around this by adding <code>use-case-hack = true</code> to your nix configuration (<code>/etc/nix/nix.conf</code> for a multi-user-install or <code>~/.config/nix/nix.conf</code> otherwise). Unfortunately, this will change the hash of some derivations and thus make the binary cache useless. | ||
=== NFS === | === NFS === | ||
With a Nix store residing on an NFS filesystem, concurrent use of Nix may corrupt Nix's sqlite database. To prevent this, set <code>use-sqlite-wal = false</code>. Since [https://github.com/NixOS/nix/pull/5475 nix/pull/5475 nix/pull/5475] and it's backports to the stable branches, a patch that was previously described in this wiki is no longer needed for using Nix on WSL (Windows' Subsystem for Linux) and NFS filesystems. | |||
- | |||
== Installing without root permissions == | == Installing without root permissions == |