From aae8892a4ab2b2a634a773b8216a5d5f5cccbebe Mon Sep 17 00:00:00 2001 From: Tim Van Baak Date: Thu, 11 Jul 2024 06:40:31 -0700 Subject: [PATCH] Add bundlers.list --- default.nix | 31 +++++++++++++++++++------------ flake.nix | 1 + 2 files changed, 20 insertions(+), 12 deletions(-) diff --git a/default.nix b/default.nix index f137900..ba24632 100644 --- a/default.nix +++ b/default.nix @@ -1,7 +1,4 @@ -{ - pkgs, - ... -}: +{ pkgs, ... }: let inherit (builtins) genericClosure @@ -14,6 +11,7 @@ let concatLines concatLists concatMap + concatStringsSep filter isDerivation isList @@ -45,14 +43,8 @@ rec { startSet = map wrap (drvOutputs drv); operator = obj: map wrap (concatLists (drvDeps obj.drv.drvAttrs)); }); - drvMaintainers = - drv: - if !hasAttr "meta" drv then - [ ] - else if !hasAttr "maintainers" drv.meta then - [ ] - else - drv.meta.maintainers; + maintainable = drv: hasAttr "meta" drv && hasAttr "maintainers" drv.meta; + drvMaintainers = drv: if maintainable drv then drv.meta.maintainers else [ ]; nobodyMaintains = drv: hasAttr "meta" drv && hasAttr "maintainers" drv.meta && (length drv.meta.maintainers) == 0; stringJoin = objToString: objs: writeText "txt" (concatLines (map objToString objs)); @@ -82,4 +74,19 @@ rec { | ${pkgs.unixtools.column}/bin/column -t \ > $out ''; + + listMaintainers = + drv: + let + closure = drvClosure drv; + maintainableDrvs = filter maintainable closure; + maintainersToString = + maintainers: concatStringsSep "," (map (main: toString main.github) maintainers); + drvToString = drv: "${drv.name} ${maintainersToString (drvMaintainers drv)}"; + in + runCommandLocal "maintainers.txt" { } '' + <${stringJoin drvToString maintainableDrvs} sort -u \ + | ${pkgs.unixtools.column}/bin/column -t \ + > $out + ''; } diff --git a/flake.nix b/flake.nix index 3c961d1..8e8245f 100644 --- a/flake.nix +++ b/flake.nix @@ -11,6 +11,7 @@ default = adopt; maintainers = lib.allMaintainers; adopt = lib.noMaintainers; + list = lib.listMaintainers; }; formatter."x86_64-linux" = pkgs.nixfmt-rfc-style;