Unfree software: Difference between revisions

From NixOS Wiki
Sdht0 (talk | contribs)
General improvements
Sdht0 (talk | contribs)
"See also" section
Line 48: Line 48:
</syntaxhighlight>
</syntaxhighlight>


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


For whitelisting '''only specific''' unfree licenses
* [https://nixos.org/nixpkgs/manual/#sec-allow-unfree Nixpkgs manual#Installing unfree packages]
see the [https://nixos.org/nixpkgs/manual/#sec-allow-unfree "Installing unfree packages" section]
of the Nixpkgs manual.

Revision as of 18:28, 6 April 2024

Hydra does not test or build unfree software by policy. Most unfree licenses have restrictions on software distribution.

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:

/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
{
  nixpkgs.config.allowUnfree = true;
}

Temporary 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 --impure "nixpkgs#vscode"

See also