This commit is contained in:
Tim Van Baak 2024-07-28 20:42:05 -07:00
parent ea6ac8389b
commit 9c0f4a922a
3 changed files with 15 additions and 20 deletions

View File

@ -7,11 +7,7 @@
{ pkgs, ... }: { pkgs, ... }:
let let
inherit (builtins) inherit (builtins) genericClosure hasAttr map;
genericClosure
hasAttr
map
;
inherit (pkgs.lib) inherit (pkgs.lib)
concatLists concatLists
concatMap concatMap
@ -22,12 +18,14 @@ let
; ;
# Map a drv or list of drvs to a list of output drvs # Map a drv or list of drvs to a list of output drvs
drvOutputs = drv: drvOutputs =
drv:
if isList drv then if isList drv then
concatMap drvOutputs drv concatMap drvOutputs drv
else if hasAttr "outputs" drv then else if hasAttr "outputs" drv then
map (out: drv.${out}) drv.outputs map (out: drv.${out}) drv.outputs
else [ drv ]; else
[ drv ];
# Map a drv or list of drvs to the outputs of referenced derivations # Map a drv or list of drvs to the outputs of referenced derivations
drvDeps = drvDeps =

View File

@ -5,11 +5,7 @@
system = "x86_64-linux"; system = "x86_64-linux";
pkgs = nixpkgs.legacyPackages.${system}; pkgs = nixpkgs.legacyPackages.${system};
lib = import ./lib.nix { inherit pkgs; }; lib = import ./lib.nix { inherit pkgs; };
inherit (lib) inherit (lib) allMaintainers expandInput noMaintainers;
allMaintainers
expandInput
noMaintainers
;
in in
{ {
bundlers."x86_64-linux" = rec { bundlers."x86_64-linux" = rec {

17
lib.nix
View File

@ -27,14 +27,15 @@ rec {
drvMaintainers = drv: if maintainable drv then drv.meta.maintainers else [ ]; drvMaintainers = drv: if maintainable drv then drv.meta.maintainers else [ ];
# Construct a link to a derivation's source in github:NixOS/nixpkgs # Construct a link to a derivation's source in github:NixOS/nixpkgs
drvSource = drv: drvSource =
let drv:
parts = match "/nix/store/[^/]+/(.*):([0-9]*)" drv.meta.position; let
in parts = match "/nix/store/[^/]+/(.*):([0-9]*)" drv.meta.position;
if hasAttr "meta" drv && hasAttr "position" drv.meta then in
"https://github.com/NixOS/nixpkgs/blob/master/${head parts}#L${head (tail parts)}" if hasAttr "meta" drv && hasAttr "position" drv.meta then
else "https://github.com/NixOS/nixpkgs/blob/master/${head parts}#L${head (tail parts)}"
""; else
"";
mainInfo = drv: { mainInfo = drv: {
name = drv.name; name = drv.name;