dotfiles/overlays/pkgs.nix

34 lines
769 B
Nix
Raw Normal View History

2025-01-30 14:48:17 -05:00
_final: prev:
2025-02-04 21:57:59 -05:00
let
2025-02-05 17:25:29 -05:00
listToAttrsByField =
field: list:
builtins.listToAttrs (
map (v: {
name = v.${field};
value = v;
}) list
);
2025-02-22 17:39:12 -05:00
listToAttrsByPnameOrName =
list:
builtins.listToAttrs (
map (v: {
name = v."pname" ? v."name";
value = v;
}) list
);
2025-02-04 21:57:59 -05:00
lib = prev.lib;
2025-02-22 17:39:12 -05:00
# packagesDirectory = lib.filesystem.listFilesRecursive ../pkgs;
packages = lib.pipe (lib.filesystem.listFilesRecursive ../pkgs) [
2025-02-05 17:25:29 -05:00
# Get only files called package.nix
2025-02-22 17:39:12 -05:00
(builtins.filter (name: lib.hasSuffix "package.nix" name))
2025-02-05 17:25:29 -05:00
# Apply callPackage to create a derivation
2025-02-22 17:39:12 -05:00
(builtins.map (name: prev.callPackage name { }))
2025-02-05 17:25:29 -05:00
# Convert the list to an attrset
2025-02-22 17:39:12 -05:00
listToAttrsByPnameOrName
2025-02-04 21:57:59 -05:00
];
in
2025-02-05 17:25:29 -05:00
packages