3
0
Fork 0
forked from mirrors/nixpkgs

config.allowUnfree: define as option

This commit is contained in:
Artturin 2022-05-02 15:49:04 +03:00
parent a585b1c709
commit 1c49b81263
3 changed files with 14 additions and 2 deletions

View file

@ -72,7 +72,7 @@ in {
})
(mkIf cfg.enableAllFirmware {
assertions = [{
assertion = !cfg.enableAllFirmware || (config.nixpkgs.config.allowUnfree or false);
assertion = !cfg.enableAllFirmware || config.nixpkgs.config.allowUnfree;
message = ''
the list of hardware.enableAllFirmware contains non-redistributable licensed firmware files.
This requires nixpkgs.config.allowUnfree to be true.

View file

@ -13,7 +13,7 @@ let
# for why this defaults to false, but I (@copumpkin) want to default it to true soon.
shouldCheckMeta = config.checkMeta or false;
allowUnfree = config.allowUnfree or false
allowUnfree = config.allowUnfree
|| builtins.getEnv "NIXPKGS_ALLOW_UNFREE" == "1";
allowlist = config.allowlistedLicenses or config.whitelistedLicenses or [];

View file

@ -58,6 +58,18 @@ let
'';
};
allowUnfree = mkOption {
type = types.bool;
default = false;
# getEnv part is in check-meta.nix
defaultText = literalExpression ''false || builtins.getEnv "NIXPKGS_ALLOW_UNFREE" == "1"'';
description = ''
Whether to allow unfree packages.
See <link xlink:href="https://nixos.org/manual/nixpkgs/stable/#sec-allow-unfree">Installing unfree packages</link> in the NixOS manual.
'';
};
};
in {