From 48422decc45a428cab7b4a8fbdc3b07755fd088a Mon Sep 17 00:00:00 2001 From: Silvan Mosberger Date: Thu, 26 Feb 2026 16:50:18 +0100 Subject: [PATCH] config: Deprecate allowBrokenPredicate in favor of problems.handlers --- doc/using/configuration.chapter.md | 4 ++-- pkgs/stdenv/generic/problems.nix | 8 +++++++- 2 files changed, 9 insertions(+), 3 deletions(-) diff --git a/doc/using/configuration.chapter.md b/doc/using/configuration.chapter.md index 9c23253549f7..5934726c068b 100644 --- a/doc/using/configuration.chapter.md +++ b/doc/using/configuration.chapter.md @@ -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" } ``` diff --git a/pkgs/stdenv/generic/problems.nix b/pkgs/stdenv/generic/problems.nix index 46d2797e248f..926075bd8229 100644 --- a/pkgs/stdenv/generic/problems.nix +++ b/pkgs/stdenv/generic/problems.nix @@ -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.";