nixos-config/modules/default.nix

18 lines
578 B
Nix
Raw Normal View History

let
findModules = dir:
builtins.concatLists (builtins.attrValues (builtins.mapAttrs (name: type:
if type == "regular" then
(if name == "default.nix" then
[ ]
else [{
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 builtins.listToAttrs (findModules ./.)