config: Deprecate allowBrokenPredicate in favor of problems.handlers

This commit is contained in:
Silvan Mosberger
2026-02-26 16:50:18 +01:00
parent 2e97caa6d3
commit 48422decc4
2 changed files with 9 additions and 3 deletions
+2 -2
View File
@@ -41,11 +41,11 @@ There are several ways to try compiling a package which has been marked as broke
$ export NIXPKGS_ALLOW_BROKEN=1
```
- For permanently allowing broken packages that match some condition to be built, you may add `allowBrokenPredicate` to your user's configuration file with the desired condition, for example:
- For permanently allowing broken packages with a specific name to be built, you may add a corresponding `problems.handlers` to your user's configuration file, for example:
```nix
{
allowBrokenPredicate = pkg: builtins.elem (pkgs.lib.getName pkg) [ "hello" ];
problems.handlers.hello.broken = "warn"; # or "ignore"
}
```
+7 -1
View File
@@ -118,7 +118,13 @@ rec {
# TODO: Consider deprecating this or making it generic for all problems
allowBroken = config.allowBroken || builtins.getEnv "NIXPKGS_ALLOW_BROKEN" == "1";
allowBrokenPredicate = config.allowBrokenPredicate or (x: false);
allowBrokenPredicate =
if config ? allowBrokenPredicate then
lib.warnIf (lib.oldestSupportedReleaseIsAtLeast 2605)
"config.allowBrokenPredicate is deprecated, use config.problems.handlers.myPackage.broken = \"warn\" for individual packages instead."
config.allowBrokenPredicate
else
x: false;
in
attrs: attrs.meta.broken or false && !allowBroken && !allowBrokenPredicate attrs;
value.message = "This package is broken.";