2024-05-06 14:32:00 -05:00
|
|
|
{ ... }:
|
|
|
|
let
|
|
|
|
inherit (builtins)
|
|
|
|
concatLists
|
|
|
|
attrValues
|
|
|
|
mapAttrs
|
|
|
|
elemAt
|
|
|
|
match
|
|
|
|
readDir
|
|
|
|
;
|
|
|
|
in
|
|
|
|
rec {
|
2024-03-17 06:17:19 -05:00
|
|
|
# https://github.com/balsoft/nixos-config/blob/73cc2c3a8bb62a9c3980a16ae70b2e97af6e1abd/flake.nix#L109-L120
|
2024-05-06 14:32:00 -05:00
|
|
|
findModulesList =
|
|
|
|
dir:
|
|
|
|
concatLists (
|
|
|
|
attrValues (
|
|
|
|
mapAttrs (
|
|
|
|
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}")
|
|
|
|
) (readDir dir)
|
|
|
|
)
|
|
|
|
);
|
2024-03-17 06:17:19 -05:00
|
|
|
}
|