Unfree software: Difference between revisions

From NixOS Wiki
imported>Hypnosis2839
Dander (talk | contribs)
link to nixpkgs manual instead of copying the content
 
(16 intermediate revisions by 7 users not shown)
Line 1: Line 1:
Unfree software refers to software that has restrictive licensing on modification and/or redistribution. This type of software cannot be freely provided or distributed in an official capacity, which means that unfree software is neither built by [[Hydra]], nor cached on the official [[Binary Cache|binary cache]]. Despite this, Nixpkgs offers a very large collection of unfree software as derivations, however they cannot be used by default without configuring Nixpkgs and opting in to unfree software usage.


=== Per-package (Ideal) ===
[https://nixos.org/manual/nixpkgs/stable/#sec-allow-unfree Nixpkgs manual on allowing unfree packages]
This method works for NixOS system level configuration and Home-Manager standalone
<syntaxhighlight lang="nix">
{lib, ...}: {
  nixpkgs.config.allowUnfreePredicate = pkg:
    builtins.elem (lib.getName pkg) [
      # Add additional package names here
      "hello-unfree"
    ];
}
</syntaxhighlight>
=== For all packages ===


This method works for NixOS system-level configuration:
[[Category:Software]]
 
[[Category:Nixpkgs]]
<syntaxhighlight lang="nix">
{
  nixpkgs.config.allowUnfree = true;
}
</syntaxhighlight>
 
If you use standalone Home-Manager, and you are on the stable (23.05) branch or any commmit before [https://github.com/nix-community/home-manager/commit/b2a2133c9a0b0aa4d06d72b5891275f263ee08df this commit], use the following instead:
 
<syntaxhighlight lang="nix">
{
  nixpkgs.config.allowUnfreePredicate = _: true;
}
</syntaxhighlight>
 
=== Command Line ===
 
You won't be able to install or search for an unfree package as a user, unless you explicitly enable it in <code>~/.config/nixpkgs/config.nix</code> (the file and folder may need to be created):
 
<syntaxhighlight lang="nix">
{
  allowUnfree = true;
}
</syntaxhighlight>
 
 
=== Temporary allowing ===
 
For temporary allowing unfree packages you can set the environment variable <code>NIXPKGS_ALLOW_UNFREE</code>, e.g.
 
<syntaxhighlight lang="bash">$ NIXPKGS_ALLOW_UNFREE=1 nix-shell</syntaxhighlight>
 
Note for nix3 commands you need to pass <code>--impure</code> as well
 
=== More precision ===
 
For whitelisting '''only specific''' unfree licenses
see the [https://nixos.org/nixpkgs/manual/#sec-allow-unfree "Installing unfree packages" section]
of the Nixpkgs manual.
 
Note that we are not able to test or build unfree software on Hydra
due to policy. Most unfree licenses prohibit us from either executing or
distributing the software.

Latest revision as of 22:25, 26 October 2024

Unfree software refers to software that has restrictive licensing on modification and/or redistribution. This type of software cannot be freely provided or distributed in an official capacity, which means that unfree software is neither built by Hydra, nor cached on the official binary cache. Despite this, Nixpkgs offers a very large collection of unfree software as derivations, however they cannot be used by default without configuring Nixpkgs and opting in to unfree software usage.

Nixpkgs manual on allowing unfree packages