Unfree software: Difference between revisions
imported>GetPsyched m Typo in commit |
General improvements |
||
Line 1: | Line 1: | ||
Hydra does not test or build unfree software by policy. Most unfree licenses have restrictions on software distribution. | |||
=== Per-package (Ideal) === | === Per-package (Ideal) === | ||
This method works for NixOS system level configuration and Home-Manager standalone | This method works for NixOS system level configuration and Home-Manager standalone | ||
<syntaxhighlight lang="nix"> | <syntaxhighlight lang="nix"> | ||
{lib, ...}: { | {lib, ...}: { | ||
Line 11: | Line 13: | ||
} | } | ||
</syntaxhighlight> | </syntaxhighlight> | ||
=== For all packages === | === For all packages === | ||
This method works for NixOS system-level configuration: | This method works for NixOS system-level configuration: | ||
< | {{file|/etc/nixos/configuration.nix|nix|<nowiki> | ||
{ | { | ||
nixpkgs.config.allowUnfree = true; | nixpkgs.config.allowUnfree = true; | ||
} | } | ||
</ | </nowiki>}} | ||
} | |||
=== Command Line === | === Command Line === | ||
You won't be able to install or search for an unfree package as a user | You won't be able to install or search for an unfree package as a user unless you explicitly enable it: | ||
< | {{file|~/.config/nixpkgs/config.nix|nix|<nowiki> | ||
{ | { | ||
allowUnfree = true; | nixpkgs.config.allowUnfree = true; | ||
} | } | ||
</ | </nowiki>}} | ||
=== Temporary allowing === | |||
For temporary allowing unfree packages, you can use an environment variable: | |||
<syntaxhighlight lang="bash"> | |||
$ NIXPKGS_ALLOW_UNFREE=1 nix-shell -p vscode | |||
</syntaxhighlight> | |||
< | Note for the new nix3-style commands, you need to pass <code>--impure</code> as well: | ||
<syntaxhighlight lang="bash"> | |||
$ NIXPKGS_ALLOW_UNFREE=1 nix run --impure "nixpkgs#vscode" | |||
</syntaxhighlight> | |||
=== More precision === | === More precision === | ||
Line 53: | Line 53: | ||
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. | ||
Revision as of 18:25, 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"
More precision
For whitelisting only specific unfree licenses see the "Installing unfree packages" section of the Nixpkgs manual.