-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathkinda-utils.nix
33 lines (33 loc) · 1.03 KB
/
kinda-utils.nix
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
# TODO check out actual shared utils?
let
# copied from github:belsoft/nixos
findModules = dir:
builtins.concatLists (
builtins.attrValues (
builtins.mapAttrs
(
name: type:
if type == "regular" && ((builtins.match "(.*)\\.org" name) != null)
then []
else if type == "regular" then
[
{
name = builtins.elemAt (builtins.match "(.*)\\.nix" name) 0;
value = dir + "/${name}";
}
]
else if (builtins.readDir (dir + "/${name}"))
? "default.nix" then [
{
inherit name;
value = dir + "/${name}";
}
] else
findModules (dir + "/${name}")
)
(builtins.readDir dir)
)
);
in {
inherit findModules;
}