os/lib/devos/recImport.nix

13 lines
353 B
Nix
Raw Normal View History

2021-04-18 01:35:05 +00:00
{ lib, ... }:
{ dir, _import ? base: import "${dir}/${base}.nix" }:
2021-04-18 01:35:05 +00:00
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))
2021-04-18 01:35:05 +00:00
(lib.safeReadDir dir)