diff --git a/pkgs/stdenv/generic/check-meta.nix b/pkgs/stdenv/generic/check-meta.nix index 08e2c7a37a09..724e8b8ccac4 100644 --- a/pkgs/stdenv/generic/check-meta.nix +++ b/pkgs/stdenv/generic/check-meta.nix @@ -18,6 +18,7 @@ let isFunction isString length + mapAttrsToList mutuallyExclusive optional optionalString @@ -25,6 +26,7 @@ let unsafeGetAttrPos warn all + groupBy ; inherit (lib.lists) @@ -134,8 +136,6 @@ let hasUnfreeLicense = attrs: attrs ? meta.license && isUnfree attrs.meta.license; - isMarkedBroken = attrs: attrs.meta.broken or false; - # Logical inversion of meta.availableOn for hostPlatform hasUnsupportedPlatform = if allowUnsupportedSystem then @@ -450,6 +450,9 @@ let # meta = checkMeta.commonMeta hostPlatform { inherit validity attrs pos references; }; # validity = checkMeta.assertValidity hostPlatform { inherit meta attrs; }; commonMeta = + let + completeMetaProblems' = completeMetaProblems config; + in hostPlatform: let hasUnsupportedPlatform' = hasUnsupportedPlatform hostPlatform; @@ -465,6 +468,17 @@ let hasOutput = out: elem out outputs; maintainersPosition = unsafeGetAttrPos "maintainers" (attrs.meta or { }); teamsPosition = unsafeGetAttrPos "teams" (attrs.meta or { }); + + problems = completeMetaProblems' attrs; + problemsGroupedByKind = groupBy (p: p.name) ( + mapAttrsToList (name: problem: { + inherit name; + inherit problem; + }) problems + ); + + problemsByKind = kind: problemsGroupedByKind.${kind} or [ ]; + hasProblemKind = kind: (problemsByKind kind) != [ ]; in { # `name` derivation attribute includes cross-compilation cruft, @@ -591,11 +605,11 @@ let # Expose the result of the checks for everyone to see. unfree = hasUnfreeLicense attrs; - broken = isMarkedBroken attrs; + broken = hasProblemKind "broken"; unsupported = hasUnsupportedPlatform' attrs; insecure = isMarkedInsecure attrs; - problems = completeMetaProblems config attrs; + inherit problems; available = validity.valid != "no" diff --git a/pkgs/stdenv/generic/problems.nix b/pkgs/stdenv/generic/problems.nix index 887242e53684..ae2ef4a59e22 100644 --- a/pkgs/stdenv/generic/problems.nix +++ b/pkgs/stdenv/generic/problems.nix @@ -525,9 +525,13 @@ rec { processProblems pname problemsToHandle; completeMetaProblems = - config: attrs: + config: + let + automaticProblems = genAutomaticProblems config; + in + attrs: mapAttrs (name: problem: { kind = name; } // problem) ( - (attrs.meta.problems or { }) // genAutomaticProblems config attrs + (attrs.meta.problems or { }) // automaticProblems attrs ); processProblems =