Unfree software: Difference between revisions

From NixOS Wiki
(Fix ~/.config/nixpkgs/config.nix example)
(allowUnfree works in home-manager post issue #2942)
Line 2: Line 2:


=== Per-package (Ideal) ===
=== Per-package (Ideal) ===
This method works for both NixOS system level configuration and standalone [[Home manager]]:
This method works for both NixOS system level configuration and [[Home manager]]:


{{file|/etc/nixos/configuration.nix|nix|<nowiki>
{{file|/etc/nixos/configuration.nix|nix|<nowiki>
Line 14: Line 14:
=== For all packages ===
=== For all packages ===


This method works for NixOS system-level configuration:
This method works for both NixOS system level configuration and [[Home manager]]:


{{file|/etc/nixos/configuration.nix|nix|<nowiki>
{{file|/etc/nixos/configuration.nix|nix|<nowiki>

Revision as of 02:32, 14 June 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 both NixOS system level configuration and Home manager:

/etc/nixos/configuration.nix
{
  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;
}

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

See also