Add bundlers.list

This commit is contained in:
Tim Van Baak 2024-07-11 06:40:31 -07:00
parent 2c1b4de20f
commit aae8892a4a
2 changed files with 20 additions and 12 deletions

View File

@ -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
'';
}

View File

@ -11,6 +11,7 @@
default = adopt;
maintainers = lib.allMaintainers;
adopt = lib.noMaintainers;
list = lib.listMaintainers;
};
formatter."x86_64-linux" = pkgs.nixfmt-rfc-style;