Merge pull request #171248 from Artturin/addtoconfig1

This commit is contained in:
Artturi 2022-05-03 15:44:22 +03:00 committed by GitHub
commit e982910064
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 40 additions and 4 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 [];
@ -34,10 +34,10 @@ let
hasBlocklistedLicense = assert areLicenseListsValid; attrs:
hasLicense attrs && lib.lists.any (l: builtins.elem l blocklist) (lib.lists.toList attrs.meta.license);
allowBroken = config.allowBroken or false
allowBroken = config.allowBroken
|| builtins.getEnv "NIXPKGS_ALLOW_BROKEN" == "1";
allowUnsupportedSystem = config.allowUnsupportedSystem or false
allowUnsupportedSystem = config.allowUnsupportedSystem
|| builtins.getEnv "NIXPKGS_ALLOW_UNSUPPORTED_SYSTEM" == "1";
isUnfree = licenses: lib.lists.any (l: !l.free or true) licenses;

View File

@ -58,6 +58,42 @@ 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.
'';
};
allowBroken = mkOption {
type = types.bool;
default = false;
# getEnv part is in check-meta.nix
defaultText = literalExpression ''false || builtins.getEnv "NIXPKGS_ALLOW_BROKEN" == "1"'';
description = ''
Whether to allow broken packages.
See <link xlink:href="https://nixos.org/manual/nixpkgs/stable/#sec-allow-broken">Installing broken packages</link> in the NixOS manual.
'';
};
allowUnsupportedSystem = mkOption {
type = types.bool;
default = false;
# getEnv part is in check-meta.nix
defaultText = literalExpression ''false || builtins.getEnv "NIXPKGS_ALLOW_UNSUPPORTED_SYSTEM" == "1"'';
description = ''
Whether to allow unsupported packages.
See <link xlink:href="https://nixos.org/manual/nixpkgs/stable/#sec-allow-unsupported-system">Installing packages on unsupported systems</link> in the NixOS manual.
'';
};
};
in {