mirror of
https://github.com/ellmau/nixos.git
synced 2025-12-19 09:29:36 +01:00
15 lines
366 B
Nix
15 lines
366 B
Nix
final: prev:
|
|
|
|
with prev; rec {
|
|
moduleNames = dir: pipe dir [
|
|
builtins.readDir
|
|
(filterAttrs (name: type: !hasPrefix "." name && (hasSuffix ".nix" name || type == "directory")))
|
|
attrNames
|
|
];
|
|
discoverModules = dir: f:
|
|
listToAttrs (map
|
|
(filename:
|
|
nameValuePair (removeSuffix ".nix" filename) (f filename))
|
|
(moduleNames dir));
|
|
}
|