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;
|
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
|
# only subdirectories: filter the entries attribute-set and get the names
|
||||||
# committed directories use them directly. (If you use git submodules,
|
pkgNames = lib.attrNames (lib.filterAttrs (_: t: t == "directory") entries);
|
||||||
# their contents are not available during flake evaluation unless
|
|
||||||
# vendored.)
|
|
||||||
pkgNames = entries;
|
|
||||||
|
|
||||||
loadPkg = name:
|
loadPkg = name:
|
||||||
let
|
let
|
||||||
|
|||||||
Reference in New Issue
Block a user