devos/lib/lists.nix

20 lines
474 B
Nix
Raw Normal View History

{ 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
2021-04-18 03:35:05 +02:00
map fullPath (lib.attrNames (lib.safeReadDir dir));
}