summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authortv <tv@krebsco.de>2022-12-09 00:28:58 +0100
committertv <tv@krebsco.de>2022-12-09 01:34:31 +0100
commit896d690725f6c01ceab04097c196b021b5ded639 (patch)
tree5e495566e2494c5de8c0a1fba09468e2f133bfbd
parente4c88e7a5ae6ebd1fc8f34c1b4036daa4aed5a0e (diff)
lib.mapNixDir: admit just files with .nix suffix
-rw-r--r--lib/default.nix9
1 files changed, 6 insertions, 3 deletions
diff --git a/lib/default.nix b/lib/default.nix
index 7c3b037..d65c891 100644
--- a/lib/default.nix
+++ b/lib/default.nix
@@ -95,9 +95,12 @@ let
path = dirPath + "/${relPath}";
in
nameValuePair (toPackageName name) (f path))
- (filter
- (name: name != "default.nix" && !hasPrefix "." name)
- (attrNames (readDir dirPath))));
+ (attrNames
+ (filterAttrs
+ (name: type:
+ (type == "regular" && hasSuffix ".nix" name && name != "default.nix") ||
+ (type == "directory" && !hasPrefix "." name))
+ (readDir dirPath))));
# https://tools.ietf.org/html/rfc5952
normalize-ip6-addr =