Jump to content

Unfree software: Difference between revisions

m
Tomodachi94 moved page Unfree Software to Unfree software: use sentance case
imported>Gerg-L
mNo edit summary
m (Tomodachi94 moved page Unfree Software to Unfree software: use sentance case)
 
(16 intermediate revisions by 8 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.


=== Per-package (Ideal) ===
== Using unfree packages ==
This method works for NixOS system level configuration and Home-Manager standalone
=== Per-package (preferred) ===
<syntaxhighlight lang="nix">
This method works for both NixOS system level configuration and [[Home Manager]]:
{lib, ...}: {
 
   nixpkgs.config.allowUnfreePredicate = pkg:
{{file|/etc/nixos/configuration.nix|nix|<nowiki>
    builtins.elem (lib.getName pkg) [
{
      # Add additional package names here
   nixpkgs.config.allowUnfreePredicate = pkg: builtins.elem (lib.getName pkg) [
      "hello-unfree"
    "vscode"
    ];
  ];
}
}
</syntaxhighlight>
 
</nowiki>}}
 
=== For all packages ===
=== For all packages ===
This method works for NixOS system level configuration
 
<syntaxhighlight lang="nix">
This method works for both NixOS system level configuration and [[Home Manager]]:
 
{{file|/etc/nixos/configuration.nix|nix|<nowiki>
{
{
   nixpkgs.config.allowUnfree = true;
   nixpkgs.config.allowUnfree = true;
}
}
</syntaxhighlight>
</nowiki>}}
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>
 


=== Command Line ===
=== Command line ===


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):
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;
   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 for the new nix3-style commands, you need to pass <code>--impure</code> as well:


=== Temporary allowing ===
<syntaxhighlight lang="bash">
 
$ NIXPKGS_ALLOW_UNFREE=1 nix run nixpkgs#vscode --impure
For temporary allowing unfree packages you can set the environment variable ''NIXPKGS_ALLOW_UNFREE'', e.g.
</syntaxhighlight>


<syntaxhighlight lang="bash">$ NIXPKGS_ALLOW_UNFREE=1 nix-shell</syntaxhighlight>
== Hydra ==


Note for nix3 commands you need to pass <code>--impure</code> as well
[[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 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.
134

edits