Unfree software: Difference between revisions

From NixOS Wiki
imported>Gerg-L
No edit summary
imported>Hypnosis2839
m →‎For all packages: formatting, grammar
Line 12: Line 12:
</syntaxhighlight>
</syntaxhighlight>
=== For all packages ===
=== For all packages ===
This method works for NixOS system level configuration
 
This method works for NixOS system level configuration:
 
<syntaxhighlight lang="nix">
<syntaxhighlight lang="nix">
{
{
Line 18: Line 20:
}
}
</syntaxhighlight>
</syntaxhighlight>
The previous method '''should''' work for Home-Manager standalone
 
If you're on the master branch update past this [https://github.com/nix-community/home-manager/commit/b2a2133c9a0b0aa4d06d72b5891275f263ee08df commit]
If you use standalone Home-Manager, and you are on the stable (23.05) branch or any commmit before [https://github.com/nix-community/home-manager/commit/b2a2133c9a0b0aa4d06d72b5891275f263ee08df this commit], use the folliwing instead:
on home-manager 23.05 the work-around is using:
 
<syntaxhighlight lang="nix">
<syntaxhighlight lang="nix">
{
{
Line 26: Line 28:
}
}
</syntaxhighlight>
</syntaxhighlight>


=== Command Line ===
=== Command Line ===

Revision as of 22:04, 9 October 2023

Per-package (Ideal)

This method works for NixOS system level configuration and Home-Manager standalone

{lib, ...}: {
  nixpkgs.config.allowUnfreePredicate = pkg:
    builtins.elem (lib.getName pkg) [
      # Add additional package names here
      "hello-unfree"
    ];
}

For all packages

This method works for NixOS system level configuration:

{
  nixpkgs.config.allowUnfree = true;
}

If you use standalone Home-Manager, and you are on the stable (23.05) branch or any commmit before this commit, use the folliwing instead:

{
  nixpkgs.config.allowUnfreePredicate = _: true;
}

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):

{
  allowUnfree = true;
}


Temporary allowing

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

$ NIXPKGS_ALLOW_UNFREE=1 nix-shell

Note for nix3 commands you need to pass --impure as well

More precision

For whitelisting only specific unfree licenses see the "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.