mirror of
https://github.com/daylinmorgan/oizys.git
synced 2025-02-02 15:04:18 -06:00
34 lines
632 B
Nix
34 lines
632 B
Nix
{ ... }:
|
|
let
|
|
inherit (builtins)
|
|
concatLists
|
|
attrValues
|
|
mapAttrs
|
|
elemAt
|
|
match
|
|
readDir
|
|
;
|
|
in
|
|
rec {
|
|
|
|
handleModule =
|
|
dir: name: type:
|
|
if type == "regular" then
|
|
[
|
|
{
|
|
name = elemAt (match "(.*)\\.nix" name) 0;
|
|
value = dir + "/${name}";
|
|
}
|
|
]
|
|
else if (readDir (dir + "/${name}")) ? "default.nix" then
|
|
[
|
|
{
|
|
inherit name;
|
|
value = dir + "/${name}";
|
|
}
|
|
]
|
|
else
|
|
findModulesList (dir + "/${name}");
|
|
|
|
findModulesList = dir: (readDir dir) |> mapAttrs (handleModule dir) |> attrValues |> concatLists;
|
|
}
|