Unfree software: Difference between revisions
imported>Gerg-L m Gerg-L moved page How can I install a proprietary or unfree package? to Unfree Software: forgot to change title oops |
imported>Gerg-L No edit summary |
||
Line 1: | Line 1: | ||
=== Per-package (Ideal) === | |||
This method works for NixOS system level configuration and Home-Manager standalone | |||
<syntaxhighlight lang="nix"> | |||
{lib, ...}: { | |||
nixpkgs.config.allowUnfreePredicate = pkg: | |||
builtins.elem (lib.getName pkg) [ | |||
# Add additional package names here | |||
"hello-unfree" | |||
]; | |||
} | |||
</syntaxhighlight> | |||
=== For all packages === | |||
This method works for NixOS system level configuration | |||
<syntaxhighlight lang="nix"> | |||
{ | |||
nixpkgs.config.allowUnfree = true; | |||
} | |||
</syntaxhighlight> | |||
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"> | <syntaxhighlight lang="nix"> | ||
{ | { | ||
nixpkgs.config.allowUnfreePredicate = _: true; | |||
} | } | ||
</syntaxhighlight> | </syntaxhighlight> | ||
=== Imperative CLI === | |||
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): | |||
<syntaxhighlight lang="nix"> | <syntaxhighlight lang="nix"> | ||
{ | { | ||
allowUnfree = true; | |||
} | } | ||
</syntaxhighlight> | </syntaxhighlight> | ||
=== Temporary allowing === | === Temporary allowing === | ||
Line 29: | Line 43: | ||
For temporary allowing unfree packages you can set the environment variable ''NIXPKGS_ALLOW_UNFREE'', e.g. | For temporary allowing unfree packages you can set the environment variable ''NIXPKGS_ALLOW_UNFREE'', e.g. | ||
<syntaxhighlight lang="bash">NIXPKGS_ALLOW_UNFREE=1 nix- | <syntaxhighlight lang="bash">$ NIXPKGS_ALLOW_UNFREE=1 nix-shell</syntaxhighlight> | ||
Note for nix3 commands you need to pass <code>--impure</code> as well | |||
=== More precision === | === More precision === | ||
For whitelisting '''only specific''' | For whitelisting '''only specific''' unfree licenses | ||
see the [https://nixos.org/nixpkgs/manual/#sec-allow-unfree "Installing unfree packages" section] | see the [https://nixos.org/nixpkgs/manual/#sec-allow-unfree "Installing unfree packages" section] | ||
of the Nixpkgs manual. | of the Nixpkgs manual. | ||
Line 40: | Line 56: | ||
due to policy. Most unfree licenses prohibit us from either executing or | due to policy. Most unfree licenses prohibit us from either executing or | ||
distributing the software. | distributing the software. | ||