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

View File

@ -5,11 +5,7 @@
system = "x86_64-linux";
pkgs = nixpkgs.legacyPackages.${system};
lib = import ./lib.nix { inherit pkgs; };
inherit (lib)
allMaintainers
expandInput
noMaintainers
;
inherit (lib) allMaintainers expandInput noMaintainers;
in
{
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 [ ];
# Construct a link to a derivation's source in github:NixOS/nixpkgs
drvSource = drv:
let
parts = match "/nix/store/[^/]+/(.*):([0-9]*)" drv.meta.position;
in
if hasAttr "meta" drv && hasAttr "position" drv.meta then
"https://github.com/NixOS/nixpkgs/blob/master/${head parts}#L${head (tail parts)}"
else
"";
drvSource =
drv:
let
parts = match "/nix/store/[^/]+/(.*):([0-9]*)" drv.meta.position;
in
if hasAttr "meta" drv && hasAttr "position" drv.meta then
"https://github.com/NixOS/nixpkgs/blob/master/${head parts}#L${head (tail parts)}"
else
"";
mainInfo = drv: {
name = drv.name;