1
1
mirror of https://github.com/divnix/digga.git synced 2024-11-30 11:02:29 +03:00
digga/lib/lists.nix
Pacman99 ceef51425e init unifyOverlays: to pass channels to overlays
Only to those with three arguments
2021-04-26 11:27:00 -07:00

22 lines
573 B
Nix

{ lib }:
{
collectProfiles = set:
let
collectNestedProfiles = set:
lib.mapAttrsToList (n: v:
if builtins.isAttrs v then
[ v.default or null ] ++ collectNestedProfiles v
else null
) set;
in
builtins.filter (x: x != null) (lib.flatten (collectNestedProfiles set));
pathsIn = dir:
let
fullPath = name: "${toString dir}/${name}";
in
map fullPath (lib.attrNames (lib.safeReadDir dir));
unifyOverlays = channels: map (o: if builtins.isFunction (o null null) then o channels else o);
}