flake: properly handle builtins.readDir attrset and compute pkgNames
This commit is contained in:
11
flake.nix
11
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
|
||||
|
||||
Reference in New Issue
Block a user