Unfree software: Difference between revisions

From NixOS Wiki
Sdht0 (talk | contribs)
"See also" section
Dander (talk | contribs)
link to nixpkgs manual instead of copying the content
 
(13 intermediate revisions by 6 users not shown)
Line 1: Line 1:
Hydra does not test or build unfree software by policy. Most unfree licenses have restrictions on software distribution.
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">
[[Category:Software]]
{lib, ...}: {
[[Category:Nixpkgs]]
  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:
 
{{file|/etc/nixos/configuration.nix|nix|<nowiki>
{
  nixpkgs.config.allowUnfree = true;
}
</nowiki>}}
 
=== Command Line ===
 
You won't be able to install or search for an unfree package as a user unless you explicitly enable it:
 
{{file|~/.config/nixpkgs/config.nix|nix|<nowiki>
{
  nixpkgs.config.allowUnfree = true;
}
</nowiki>}}
 
=== Temporary allowing ===
 
For temporary allowing unfree packages, you can use an environment variable:
 
<syntaxhighlight lang="bash">
$ NIXPKGS_ALLOW_UNFREE=1 nix-shell -p vscode
</syntaxhighlight>
 
Note for the new nix3-style commands, you need to pass <code>--impure</code> as well:
 
<syntaxhighlight lang="bash">
$ NIXPKGS_ALLOW_UNFREE=1 nix run --impure "nixpkgs#vscode"
</syntaxhighlight>
 
=== See also ===
 
* [https://nixos.org/nixpkgs/manual/#sec-allow-unfree Nixpkgs manual#Installing unfree packages]

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