Nix Installation Guide: Difference between revisions
imported>Symphorien →PRoot: explain how to build a recent version oneself. |
imported>Symphorien Nix store on CIFS and NFS |
||
Line 11: | Line 11: | ||
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>). | ||
== Nix store on an unusual filesystem == | |||
=== Case insensitive filesystem on Linux === | |||
Most Linux filesystems are case sensitive. If your nix store is on a case sensitive 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 === | |||
Without special care, concurrent use of Nix if the nix store is on a NFS filesystem may corrupt Nix's sqlite database. | |||
To prevent this, add <code>use-sqlite-wal = false</code> to your nix configuration and recompile nix with this patch: | |||
<syntaxHighlight lang="diff"> | |||
--- a/src/libstore/sqlite.cc | |||
+++ b/src/libstore/sqlite.cc | |||
@@ -28,7 +28,7 @@ namespace nix { | |||
SQLite::SQLite(const Path & path) | |||
{ | |||
if (sqlite3_open_v2(path.c_str(), &db, | |||
- SQLITE_OPEN_READWRITE | SQLITE_OPEN_CREATE, 0) != SQLITE_OK) | |||
+ SQLITE_OPEN_READWRITE | SQLITE_OPEN_CREATE, "unix-dotfile") != SQLITE_OK) | |||
throw Error(format("cannot open SQLite database '%s'") % path); | |||
}</syntaxHighlight> | |||
(source: [https://github.com/NixOS/nix/issues/2357 this issue]) | |||
Nix is hard to build by hand, but you can still use vanilla nix without concurrent use, so you can install nix with a NFS store as follows: | |||
* Install nix with the vanilla binary installer | |||
* Create a file <code>nfs-nix.nix</code>: | |||
<syntaxHighlight lang="nix"> | |||
with import <nixpkgs> {}; | |||
nix.overrideAttrs (old: { | |||
patches = (old.patch or []) ++ [ ./nfs.patch ]; | |||
# if you are in a hurry | |||
doInstallCheck = false; | |||
}) | |||
</syntaxHighlight> | |||
* Run <code>nix-env -if ./nfs-nix.nix</code> | |||
* From then on, you can use nix concurrently without risk of corrupting the sqlite database. | |||
== Installing without root permissions == | == Installing without root permissions == |