diff options
author | Azat Bahawi <azat@bahawi.net> | 2024-05-25 22:16:47 +0300 |
---|---|---|
committer | Azat Bahawi <azat@bahawi.net> | 2024-05-25 22:16:47 +0300 |
commit | 364e8a98ad25127f2a51696ec03729e3a783044f (patch) | |
tree | 1ac46553d1dca1259da539eddc7db100eaf5c137 /lib/default.nix | |
parent | 2024-05-05 (diff) |
2024-05-25
Diffstat (limited to '')
-rw-r--r-- | lib/default.nix | 19 |
1 files changed, 6 insertions, 13 deletions
diff --git a/lib/default.nix b/lib/default.nix index cd4b601..a6a25c9 100644 --- a/lib/default.nix +++ b/lib/default.nix @@ -33,20 +33,13 @@ lib: _: with lib; rec { builtins.readDir (mapAttrsToList ( name: type: + let + modulePath = dir + "/${name}"; + in if type == "regular" && hasSuffix ".nix" name && name != "default.nix" then - [ - { - name = removeSuffix ".nix" name; - value = dir + "/${name}"; - } - ] - else if type == "directory" && pathExists (dir + "/${name}/default.nix") then - [ - { - inherit name; - value = dir + "/${name}"; - } - ] + [ (nameValuePair (removeSuffix ".nix" name) modulePath) ] + else if type == "directory" && pathExists (modulePath + "/default.nix") then + [ (nameValuePair name modulePath) ] else [ ] )) |