Jump to content

Unfree software: Difference between revisions

From Official NixOS Wiki
imported>Gerg-L
No edit summary
Smudgebun (talk | contribs)
Added a link to the section of the Flakes page on unfree software.
 
(26 intermediate revisions by 11 users not shown)
Line 1: Line 1:
{{expansion}}


=== Per-package (Ideal) ===
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.
This method works for NixOS system level configuration and Home-Manager standalone
 
<syntaxhighlight lang="nix">
[https://nixos.org/manual/nixpkgs/stable/#sec-allow-unfree Nixpkgs manual on allowing unfree packages]
{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
<syntaxhighlight lang="nix">
{
  nixpkgs.config.allowUnfree = true;
}
</syntaxhighlight>
This previous method '''should''' work for Home-Manager standalone but is currently broken
see: [https://github.com/nix-community/home-manager/issues/2942 Home-Manager Issue 2942]
the work-around is using:
<syntaxhighlight lang="nix">
{
  nixpkgs.config.allowUnfreePredicate = _: true;
}
</syntaxhighlight>


== 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.


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


You won't be able to install or search for an unfree package as a user, unless you explicitly enable it in ''~/.config/nixpkgs/config.nix'' (the file and folder may need to be created):
=== Unfree software using Home Manager ===
Depending on your [[Home Manager]] installation, there are multiple ways to allow unfree software.


<syntaxhighlight lang="nix">
==== 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>{ ... }:
{
{
   allowUnfree = true;
   ...
}
  nixpkgs.config.allowUnfree = true;
</syntaxhighlight>
}</nowiki>|name=home.nix|lang=nix}}
 
[[Category:Software]]
 
[[Category:Nixpkgs]]
=== Temporary allowing ===
 
For temporary allowing unfree packages you can set the environment variable ''NIXPKGS_ALLOW_UNFREE'', 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 04:51, 21 April 2026

☶︎
This article or section needs to be expanded. Further information may be found in the related discussion page. Please consult the pedia article metapage for guidelines on contributing.

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

Allowing unfree software

By default, nix will refuse to evaluate any 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.

Unfree software in Flakes

For allowing unfree software in a flake-based config, see: Flakes#Enable_unfree_software.

Unfree software using Home Manager

Depending on your Home Manager installation, there are multiple ways to allow unfree software.

Standalone Home Manager

If your Home Manager configuration isn't integrated into your NixOS configuration (i.e. you switch generations using home-manager switch and not by rebuilding the whole system), then you may allow unfree software by setting the nixpkgs option in your config:

❄︎ home.nix
{ ... }:
{
  ...
  nixpkgs.config.allowUnfree = true;
}