From a421bf8521bed4166836160955105b72f05e2929 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Miskolczi=20Rich=C3=A1rd?= Date: Sun, 12 Apr 2026 19:55:46 +0200 Subject: [PATCH] flake: properly handle builtins.readDir attrset and compute pkgNames --- flake.nix | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) 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