diff --git a/lib/default.nix b/lib/default.nix index 03dcebb..b66d67d 100644 --- a/lib/default.nix +++ b/lib/default.nix @@ -16,7 +16,7 @@ lib.makeExtensible (_: rec { mapModules = f: dir: let - filter = name: type: + filterModules = name: type: let isPublic = !(lib.hasPrefix "_" name); isSomething = type != null; @@ -30,6 +30,8 @@ lib.makeExtensible (_: rec { in isPublic && isSomething && isModule; + modulesInDir = lib.filterAttrs filterModules (builtins.readDir dir); + mkModule = name: _: let path = "${toString dir}/${name}"; @@ -40,7 +42,7 @@ lib.makeExtensible (_: rec { in lib.nameValuePair normalizedName (f path); in - lib.mapAttrs' mkModule (lib.filterAttrs filter (builtins.readDir dir)); + lib.mapAttrs' mkModule modulesInDir; mapModules' = f: dir: lib.attrValues (mapModules f dir); })