{ lib, ... }:
let
  b = builtins;

  module_files =
    b.readDir ./. |>
    lib.filterAttrs (name: type:
      ( (lib.strings.hasSuffix ".nix" name
        && name != "default.nix"
        && type == "regular" )
      || ( type == "directory"
        && b.pathExists ./${name}/default.nix))
    ) |>
    b.attrNames |>
    b.map (f: ./${f});
in
{
  imports = module_files;
}