Unfree software: Difference between revisions

From NixOS Wiki
imported>Gerg-L
m (Tomodachi94 moved page Unfree Software to Unfree software: use sentance case)
 
(19 intermediate revisions by 8 users not shown)
Line 1: Line 1:
{{FAQ/breadcrumb}}{{#tweekihide:firstHeading}}<onlyinclude>
'''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.
== How can I install a proprietary or unfree package? ==


=== Configuration for a user ===
== Using unfree packages ==
=== Per-package (preferred) ===
This method works for both NixOS system level configuration and [[Home Manager]]:


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):
{{file|/etc/nixos/configuration.nix|nix|<nowiki>
{
  nixpkgs.config.allowUnfreePredicate = pkg: builtins.elem (lib.getName pkg) [
    "vscode"
  ];
}
 
</nowiki>}}
 
=== For all packages ===
 
This method works for both NixOS system level configuration and [[Home Manager]]:


<syntaxhighlight lang="nix">
{{file|/etc/nixos/configuration.nix|nix|<nowiki>
{
{
   # [...]
   nixpkgs.config.allowUnfree = true;
  allowUnfree = true;
}
}
</syntaxhighlight>
</nowiki>}}


=== System-level configuration (NixOS) ===
=== Command line ===


When using NixOS, it is possible to enable unfree for eg. <code>environment.systemPackages</code> with the following  setting in your <code>/etc/nixos/configuration.nix</code>:
You won't be able to install or search for an unfree package as a user unless you explicitly enable it:


<syntaxhighlight lang="nix">
{{file|~/.config/nixpkgs/config.nix|nix|<nowiki>
{
{
   # [...]
   allowUnfree = true;
  nixpkgs.config.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>
</syntaxhighlight>
'''Note that this alone will not allow you to search for or install packages with nix-env without the user configured.''' See the previous section. No reboot is required for unfree to take effect, however you need to run <code>nixos-rebuild switch</code> just like for all other changes to your systems <code>configuration.nix</code>


=== Temporary allowing ===
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>


For temporary allowing unfree packages you can set the environment variable ''NIXPKGS_ALLOW_UNFREE'', e.g.
== Hydra ==


<syntaxhighlight lang="bash">NIXPKGS_ALLOW_UNFREE=1 nix-env</syntaxhighlight>
[[Hydra]] does not build unfree software, and unfree software is unavailable in <code>cache.nixos.org</code>.


=== More precision ===
== See also ==


For whitelisting '''only specific''' unfree packages or unfree licenses
* [https://nixos.org/nixpkgs/manual/#sec-allow-unfree Nixpkgs manual on allowing unfree packages]
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
[[Category:Software]]
due to policy. Most unfree licenses prohibit us from either executing or
distributing the software.
</onlyinclude>

Latest revision as of 05:59, 21 June 2024

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.

Using unfree packages

Per-package (preferred)

This method works for both NixOS system level configuration and Home Manager:

/etc/nixos/configuration.nix
{
  nixpkgs.config.allowUnfreePredicate = pkg: builtins.elem (lib.getName pkg) [
    "vscode"
  ];
}

For all packages

This method works for both NixOS system level configuration and Home Manager:

/etc/nixos/configuration.nix
{
  nixpkgs.config.allowUnfree = true;
}

Command line

You won't be able to install or search for an unfree package as a user unless you explicitly enable it:

~/.config/nixpkgs/config.nix
{
  allowUnfree = true;
}

Temporarily allowing

For temporary allowing unfree packages, you can use an environment variable:

$ NIXPKGS_ALLOW_UNFREE=1 nix-shell -p vscode

Note for the new nix3-style commands, you need to pass --impure as well:

$ NIXPKGS_ALLOW_UNFREE=1 nix run nixpkgs#vscode --impure

Hydra

Hydra does not build unfree software, and unfree software is unavailable in cache.nixos.org.

See also