about summary refs log tree commit diff
path: root/pkgs/stdenv
diff options
context:
space:
mode:
authorckie <git-525ff67@ckie.dev>2022-05-03 22:17:44 +0300
committerckie <git-525ff67@ckie.dev>2022-05-03 22:29:14 +0300
commit4def222ea40aef58ee83fb00bd412b78ee807205 (patch)
treeb6cfdcec72555626a9ebd2449810033a783f64ab /pkgs/stdenv
parent3a34b6c820b1cd62ed1b1747b6cad6275e81321d (diff)
stdenv/check-meta: add a "maintainerless" warning
This warning logs when a package has no maintainers. It will stay silent
if `meta.maintainers` is not set at all, only complaining when it is an
empty list. In the future a separate warning could be added to allow for
that stricter behavior. Or this warning could be changed.
Diffstat (limited to 'pkgs/stdenv')
-rw-r--r--pkgs/stdenv/generic/check-meta.nix9
1 files changed, 9 insertions, 0 deletions
diff --git a/pkgs/stdenv/generic/check-meta.nix b/pkgs/stdenv/generic/check-meta.nix
index 4a9af7a6f67e5..1da098dabbee1 100644
--- a/pkgs/stdenv/generic/check-meta.nix
+++ b/pkgs/stdenv/generic/check-meta.nix
@@ -50,6 +50,9 @@ let
     hasLicense attrs &&
     isUnfree (lib.lists.toList attrs.meta.license);
 
+  hasNoMaintainers = attrs:
+    attrs ? meta.maintainers && (lib.length attrs.meta.maintainers) == 0;
+
   isMarkedBroken = attrs: attrs.meta.broken or false;
 
   hasUnsupportedPlatform = attrs:
@@ -95,6 +98,7 @@ let
     insecure = remediate_insecure;
     broken-outputs = remediateOutputsToInstall;
     unknown-meta = x: "";
+    maintainerless = x: "";
   };
   remediation_env_var = allow_attr: {
     Unfree = "NIXPKGS_ALLOW_UNFREE";
@@ -302,6 +306,11 @@ let
       { valid = "no"; reason = "broken-outputs"; errormsg = "has invalid meta.outputsToInstall"; }
     else let res = checkMeta (attrs.meta or {}); in if res != [] then
       { valid = "no"; reason = "unknown-meta"; errormsg = "has an invalid meta attrset:${lib.concatMapStrings (x: "\n\t - " + x) res}"; }
+    # --- warnings ---
+    # Please also update the type in /pkgs/top-level/config.nix alongside this.
+    else if hasNoMaintainers attrs then
+      { valid = "warn"; reason = "maintainerless"; errormsg = "has no maintainers"; }
+    # -----
     else { valid = "yes"; });
 
   assertValidity = { meta, attrs }: let