infrastructure/pkgs/lib/folder-list.nix
2021-08-09 23:24:13 +01:00

5 lines
301 B
Nix

{ lib }: path: excludes: let
filterAttrNamesToList = filter: set:
lib.foldl' (a: b: a ++ b) [ ]
(map (e: if (filter e set.${e}) then [ e ] else [ ]) (lib.attrNames set));
in (filterAttrNamesToList (name: type: ! (builtins.elem name excludes) && type == "directory") (builtins.readDir path))