flake: properly handle builtins.readDir attrset and compute pkgNames

This commit is contained in:
2026-04-12 19:55:46 +02:00
parent cb93e97ef5
commit a421bf8521

View File

@@ -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