Unfree software: Difference between revisions

m Copyedit
Smudgebun (talk | contribs)
Added a link to the section of the Flakes page on unfree software.
 
(9 intermediate revisions by 5 users not shown)
Line 1: Line 1:
'''Unfree software''', sometimes called '''nonfree software''', is software that cannot be freely modified or distributed. [[Nixpkgs]] provides packages for unfree software, but additional configuration is required before they can be used.
{{expansion}}


== Using unfree packages ==
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 (preferred) ===
This method works for both NixOS system level configuration and [[Home Manager]]:


{{file|/etc/nixos/configuration.nix|nix|<nowiki>
[https://nixos.org/manual/nixpkgs/stable/#sec-allow-unfree Nixpkgs manual on allowing unfree packages]
{
  nixpkgs.config.allowUnfreePredicate = pkg: builtins.elem (lib.getName pkg) [
    "vscode"
  ];
}


</nowiki>}}
== Allowing unfree software ==
By default, nix will refuse to evaluate any [[Derivations|derivation]] containing unfree software, prompting the user to read the manual for more details. This behaviour can be configured in different ways depending on the context of the derivation.


=== For all packages ===
=== Unfree software in Flakes ===
For allowing unfree software in a flake-based config, see: [[Flakes#Enable_unfree_software]].


This method works for both NixOS system level configuration and [[Home Manager]]:
=== Unfree software using Home Manager ===
Depending on your [[Home Manager]] installation, there are multiple ways to allow unfree software.


{{file|/etc/nixos/configuration.nix|nix|<nowiki>
==== Standalone Home Manager ====
If your Home Manager configuration isn't integrated into your [[NixOS]] configuration (i.e. you switch generations using <code>home-manager switch</code> and not by rebuilding the whole system), then you may allow unfree software by setting the nixpkgs option in your config:
{{File|3=<nowiki>{ ... }:
{
{
  ...
   nixpkgs.config.allowUnfree = true;
   nixpkgs.config.allowUnfree = true;
}
}</nowiki>|name=home.nix|lang=nix}}
</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>
{
  allowUnfree = true;
}
</nowiki>}}
 
=== Temporarily 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 nixpkgs#vscode --impure
</syntaxhighlight>
 
== Hydra ==
 
[[Hydra]] does not build unfree software, and unfree software is unavailable in <code>cache.nixos.org</code>.
 
== See also ==
 
* [https://nixos.org/nixpkgs/manual/#sec-allow-unfree Nixpkgs manual on allowing unfree packages]
 
[[Category:Software]]
[[Category:Software]]
[[Category:Nixpkgs]]