diff --git a/flake.nix b/flake.nix index 5d28085..66321ef 100644 --- a/flake.nix +++ b/flake.nix @@ -10,13 +10,12 @@ pkgsDir = ./pkgs; - entries = if builtins.pathExists pkgsDir then builtins.readDir pkgsDir else []; + # `builtins.readDir` returns an attribute set of entries. Use an empty + # attrset when missing so the type stays consistent during eval. + entries = if builtins.pathExists pkgsDir then builtins.readDir pkgsDir else {}; - # builtins.readDir returns a list of names; when pkgs are present as - # committed directories use them directly. (If you use git submodules, - # their contents are not available during flake evaluation unless - # vendored.) - pkgNames = entries; + # only subdirectories: filter the entries attribute-set and get the names + pkgNames = lib.attrNames (lib.filterAttrs (_: t: t == "directory") entries); loadPkg = name: let