# ============================================================================
# Host Types Module
# ============================================================================
# This module exports all available host types as an attribute set.
# Each type is a NixOS module (a function suitable for lib.types.submodule).

{ inputs }:
let
  lib = inputs.nixpkgs.lib;
  inherit (builtins) readDir attrNames;
  inherit (lib) filterAttrs removeSuffix genAttrs;

  files = readDir ./.;

  # Keep only regular *.nix files except default.nix
  nixFiles = filterAttrs (
    name: type: type == "regular" && lib.hasSuffix ".nix" name && name != "default.nix"
  ) files;

  moduleNames = map (name: removeSuffix ".nix" name) (attrNames nixFiles);
in
# Export: { name = <module function from ./name.nix>; }
genAttrs moduleNames (name: import (./. + ("/" + name + ".nix")))
