diff --git a/nixos/modules/hardware/all-firmware.nix b/nixos/modules/hardware/all-firmware.nix index 176056d0a917a..da2bc8ffef4b0 100644 --- a/nixos/modules/hardware/all-firmware.nix +++ b/nixos/modules/hardware/all-firmware.nix @@ -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. diff --git a/pkgs/stdenv/generic/check-meta.nix b/pkgs/stdenv/generic/check-meta.nix index 8ad5fa6b89bdf..e0ead55d1a786 100644 --- a/pkgs/stdenv/generic/check-meta.nix +++ b/pkgs/stdenv/generic/check-meta.nix @@ -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; diff --git a/pkgs/top-level/config.nix b/pkgs/top-level/config.nix index 1ee44a47af9ff..7665815d4125d 100644 --- a/pkgs/top-level/config.nix +++ b/pkgs/top-level/config.nix @@ -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 Installing unfree packages 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 Installing broken packages 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 Installing packages on unsupported systems in the NixOS manual. + ''; + }; + }; in {