os/lib/devos/recImport.nix
2021-04-18 22:16:53 -05:00

13 lines
348 B
Nix

{ lib }:
{ dir, _import ? base: import "${dir}/${base}.nix" }:
lib.mapFilterAttrs
(_: v: v != null)
(n: v:
if n != "default.nix" && lib.hasSuffix ".nix" n && v == "regular"
then
let name = lib.removeSuffix ".nix" n; in lib.nameValuePair (name) (_import name)
else
lib.nameValuePair ("") (null))
(lib.safeReadDir dir)