From 8fcbb3592984e1f364ec561f491790d854704264 Mon Sep 17 00:00:00 2001 From: Silvan Mosberger Date: Fri, 19 Jun 2026 16:37:00 +0200 Subject: [PATCH] meta.problems: Fill out output meta with final list of problems This ensures that external tooling can also process the problems, and helps users with debugging. --- pkgs/stdenv/generic/check-meta.nix | 3 +++ pkgs/stdenv/generic/problems.nix | 13 ++++++++++--- 2 files changed, 13 insertions(+), 3 deletions(-) diff --git a/pkgs/stdenv/generic/check-meta.nix b/pkgs/stdenv/generic/check-meta.nix index 70c009c3e83a..071bfba32452 100644 --- a/pkgs/stdenv/generic/check-meta.nix +++ b/pkgs/stdenv/generic/check-meta.nix @@ -49,6 +49,7 @@ let inherit (import ./problems.nix { inherit lib; }) problemsType genCheckProblems + completeMetaProblems ; checkProblems = genCheckProblems config; @@ -670,6 +671,8 @@ let unsupported = hasUnsupportedPlatform' attrs; insecure = isMarkedInsecure attrs; + problems = completeMetaProblems config attrs; + available = validity.valid != "no" && ((config.checkMetaRecursively or false) -> all (d: d.meta.available or true) references); diff --git a/pkgs/stdenv/generic/problems.nix b/pkgs/stdenv/generic/problems.nix index 1451e6161c90..c7b6754d729d 100644 --- a/pkgs/stdenv/generic/problems.nix +++ b/pkgs/stdenv/generic/problems.nix @@ -255,7 +255,8 @@ rec { record enum ; - kindType = enum (attrNames manualKinds); + # While we should only allow manual kinds, we need to allow `meta.problems = otherPackage.meta.problems`, which includes automatic ones as well + kindType = enum (attrNames kinds); subRecord = record { kind = kindType; message = str; @@ -275,7 +276,7 @@ rec { let kindGroups = groupBy (kind: kind) (mapAttrsToList (name: problem: problem.kind or name) v); in - all (kind: manualKinds ? ${kind} && (uniqueKinds ? ${kind} -> length kindGroups.${kind} == 1)) ( + all (kind: kinds ? ${kind} && (uniqueKinds ? ${kind} -> length kindGroups.${kind} == 1)) ( attrNames kindGroups ) ); @@ -299,7 +300,7 @@ rec { ++ concatLists ( mapAttrsToList ( kind: kindGroup: - optionals (!manualKinds ? ${kind}) ( + optionals (!kinds ? ${kind}) ( map ( el: "${ctx}.${el.name}: Problem kind ${kind}, inferred from the problem name, is invalid; expected ${kindType.name}. You can specify an explicit problem kind with `${ctx}.${el.name}.kind`" @@ -515,6 +516,12 @@ rec { in processProblems pname problemsToHandle; + completeMetaProblems = + config: attrs: + mapAttrs (name: problem: { kind = name; } // problem) ( + (attrs.meta.problems or { }) // genAutomaticProblems config attrs + ); + processProblems = pname: problemsToHandle: let