Nix Installation Guide: Difference between revisions

imported>Mic92
simplify installation
imported>Symphorien
PRoot: explain how to build a recent version oneself.
Line 67: Line 67:
=== PRoot ===
=== PRoot ===


Precompiled PRoot binaries can be downloaded from [https://github.com/proot-me/proot-static-build/releases here]
==== Obtaining PRoot ====
Precompiled PRoot binaries of an old version can be downloaded from [https://github.com/proot-me/proot-static-build/releases here].  Make sure you set the executable bit of binaries you download.


The following commands will install Nix the Nix store to <code>~/.nix</code>
Alternatively, if you have another machine with nix installed, you can build static binaries as follows:
* create a file <code>foo.nix</code>:
<syntaxHighlight lang="nix">
with import <nixpkgs> {};
pkgsStatic.proot.override { enablePython = false; }
</syntaxHighlight>
* build it:
<syntaxHighlight lang="console">
$ nix-build proot.nix
</syntaxHighlight>
The executable is to be found in <code>result/bin/proot</code>.


If nix builds within proot fail on the <code>renameat2</code> system call with something like "rename: unsupported operation", then you can try termux's [https://github.com/termux/proot fork] of PRoot.
==== Installing nix ====
* If you have user namespaces enabled, you should prefer using nix-user-choot to PRoot. So we can safely assume that if you got to this point in the page, you don't have user namespaces. Therefore you must disable the sandbox. Add the line
{{bc|<nowiki>
sandbox = false</nowiki>
}}
to <code>~/.config/nix/nix.conf</code>.
* Create the folder where the nix store is to be located: in this example <code>~/.nix</code>:
<syntaxHighlight lang="console">
<syntaxHighlight lang="console">
# first make sure the executable bit is set on the binary
$ chmod +x proot_5.1.1_x86_64_rc2--no-seccomp
$ mkdir ~/.nix
$ mkdir ~/.nix
$ ./proot_5.1.1_x86_64_rc2--no-seccomp -b ~/.nix:/nix
</syntaxHighlight>
</syntaxHighlight>


This will start a new shell, where Nix can be installed:
* Make sure PRoot is in PATH and use is to obtain a shell where <code>/nix</code> exists:
<syntaxHighlight lang="console">
$ proot -b ~/.nix:/nix
</syntaxHighlight>


* In this new shell, Nix can be installed:
<syntaxHighlight lang="console">
<syntaxHighlight lang="console">
$ curl https://nixos.org/nix/install | sh
$ curl https://nixos.org/nix/install | sh