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:
parent
1899a02870
commit
598f2257d7
|
@ -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
|
||||
|
|
|
@ -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"'';
|
||||
|
|
Loading…
Reference in a new issue