Nix (package manager): Difference between revisions

imported>Mic92
use console syntax highlighting
imported>Ixxie
m Fixed headers to standard format.
Line 3: Line 3:
This [[:Category:Discussion|discussion]] article is to cover the usage, internals and configuration of the Nix package manager.
This [[:Category:Discussion|discussion]] article is to cover the usage, internals and configuration of the Nix package manager.


= Sandbox builds =
== Sandbox builds ==


When sandbox builds are enabled,  
When sandbox builds are enabled,  
Line 17: Line 17:
Depending if you use NixOS or other platforms you can use one of the following methods to enable sandboxing.
Depending if you use NixOS or other platforms you can use one of the following methods to enable sandboxing.


== Enable sandbox builds in NixOS ==
=== Enable sandbox builds in NixOS ===


In <code>configuration.nix</code> put
In <code>configuration.nix</code> put
Line 25: Line 25:
</syntaxHighlight>
</syntaxHighlight>


== Enable sandbox builds on Non-NixOS platforms ==
=== Enable sandbox builds on Non-NixOS platforms ===


In <code>/etc/nix/nix.conf</code> put
In <code>/etc/nix/nix.conf</code> put
Line 33: Line 33:
</syntaxHighlight>
</syntaxHighlight>


= Nix on Linux =
== Nix on Linux ==


This section is about Nix on Non-NixOS Linux distributions.
This section is about Nix on Non-NixOS Linux distributions.


== Install Nix for a single user ==
=== Install Nix for a single user ===


To install Nix from any Linux distribution, use the following two commands (assumes you have the permission to use sudo and you are logged in as the user you want to install Nix for).
To install Nix from any Linux distribution, use the following two commands (assumes you have the permission to use sudo and you are logged in as the user you want to install Nix for).
Line 48: Line 48:
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>)


== Install Nix without root permissions ==
=== Install Nix without root permissions ===


By using [https://github.com/lethalman/nix-user-chroot nix-user-chroot] or [https://github.com/proot-me/PRoot PRoot]
By using [https://github.com/lethalman/nix-user-chroot nix-user-chroot] or [https://github.com/proot-me/PRoot PRoot]
Line 71: Line 71:
If the output of this command is <code>CONFIG_USER_NS=y</code> your system supports user namespaces.
If the output of this command is <code>CONFIG_USER_NS=y</code> your system supports user namespaces.


=== nix-user-chroot ===
==== nix-user-chroot ====


<code>nix-user-chroot</code> will create an environment, in which you can bind mount an directory to <code>/nix</code>.
<code>nix-user-chroot</code> will create an environment, in which you can bind mount an directory to <code>/nix</code>.
Line 102: Line 102:
Note that you can only use nix and the installed programs within the shell started by <code>nix-user-chroot</code>.
Note that you can only use nix and the installed programs within the shell started by <code>nix-user-chroot</code>.


=== PRoot ===
==== PRoot ====


Precompiled PRoot binaries can be downloaded from [https://github.com/proot-me/proot-static-build/releases here]
Precompiled PRoot binaries can be downloaded from [https://github.com/proot-me/proot-static-build/releases here]
Line 122: Line 122:
Note that you can only use nix and the installed programs within the shell started by PRoot.
Note that you can only use nix and the installed programs within the shell started by PRoot.


== Common Errors ==
=== Common Errors ===


=== Bad configuration option: gssapikexalgorithms ===
==== Bad configuration option: gssapikexalgorithms ====


Found when using an SSH binary from Nix on typically RPM-based distros like CentOS, Fedora, Scientific Linux, Redhat, etc. '''The quick fix:''' Just comment out the configuration option in the ssh config file, you probably don't need it.
Found when using an SSH binary from Nix on typically RPM-based distros like CentOS, Fedora, Scientific Linux, Redhat, etc. '''The quick fix:''' Just comment out the configuration option in the ssh config file, you probably don't need it.


=== Desktop Environment does not find .desktop files ===
==== Desktop Environment does not find .desktop files ====


IF your DE does not look in <code>$HOME/.nix-profile/share</code> for .desktop files.
IF your DE does not look in <code>$HOME/.nix-profile/share</code> for .desktop files.