summaryrefslogtreecommitdiffstats
path: root/lib
diff options
context:
space:
mode:
authortv <tv@krebsco.de>2020-10-15 14:38:36 +0200
committertv <tv@krebsco.de>2020-10-15 15:08:25 +0200
commitacdb2bea876aaadf30430e2ea3cbef62808ca24c (patch)
tree16024b7a128394399271208dd20cc4b5d0b2cabb /lib
parent83bcb46ce98ba3ec07b2208a82b05116352ec602 (diff)
lib.mapNixDir1: prefix names starting with a digit
Diffstat (limited to 'lib')
-rw-r--r--lib/default.nix6
1 files changed, 5 insertions, 1 deletions
diff --git a/lib/default.nix b/lib/default.nix
index f02959bba..be9f60f3b 100644
--- a/lib/default.nix
+++ b/lib/default.nix
@@ -60,13 +60,17 @@ let
}.${typeOf x};
mapNixDir1 = f: dirPath:
+ let
+ toPackageName = name:
+ if test "^[0-9].*" name then "_${name}" else name;
+ in
listToAttrs
(map
(relPath: let
name = removeSuffix ".nix" relPath;
path = dirPath + "/${relPath}";
in
- nameValuePair name (f path))
+ nameValuePair (toPackageName name) (f path))
(filter
(name: name != "default.nix" && !hasPrefix "." name)
(attrNames (readDir dirPath))));