1
0
Fork 1
mirror of https://github.com/NixOS/nixpkgs.git synced 2024-11-17 19:21:04 +00:00

pkgs/top-level/config.nix: add options.allowUnfreePredicate

This commit is contained in:
éclairevoyant 2024-07-28 21:37:30 -04:00
parent 1899a02870
commit 598f2257d7
No known key found for this signature in database
GPG key ID: E3813AEAA02DB54B
2 changed files with 14 additions and 1 deletions

View file

@ -113,7 +113,7 @@ let
# allowUnfree = false;
# allowUnfreePredicate = (x: pkgs.lib.hasPrefix "vscode" x.name);
# }
allowUnfreePredicate = config.allowUnfreePredicate or (x: false);
inherit (config) allowUnfreePredicate;
# Check whether unfree packages are allowed and if not, whether the
# package has an unfree license and is not explicitly allowed by the

View file

@ -108,6 +108,19 @@ let
'';
};
allowUnfreePredicate = mkOption {
type = types.functionTo types.bool;
default = _: false;
defaultText = literalExpression ''pkg: false'';
example = literalExpression ''pkg: lib.hasPrefix "vscode" pkg.name'';
description = ''
A function that specifies whether a given unfree package may be permitted.
Only takes effect if [`config.allowUnfree`](#opt-allowUnfree) is set to false.
See [Installing unfree packages](https://nixos.org/manual/nixpkgs/stable/#sec-allow-unfree) in the NixOS manual.
'';
};
allowNonSource = mkEnableOption "" // {
default = true;
defaultText = literalExpression ''true && builtins.getEnv "NIXPKGS_ALLOW_NONSOURCE" != "0"'';