# HM side of the flake; option tree is `chiasson.home.*` (docs/module-conventions.md).
{ self, inputs, ... }: {
  imports = [
    ./apps/discord.nix
    ./apps/localsend.nix
    ./apps/pokeclicker
    ./apps/spotify.nix
    ./browsers/orion.nix
    ./desktop/screenshot.nix
    ./hardware/uconsole-gamepad.nix
  ];

  # Root module: chiasson.home.enable + bash. Everything else is separate `wisdom*` exports —
  # pull those into `home.users.<name>.extraModules` on each host as needed.
  flake.homeManagerModules.wisdom =
    { config, lib, ... }:
    let
      cfg = config.chiasson.home;
    in
    {
      imports = [
        self.homeManagerModules.wisdomShellBash
      ];

      options.chiasson.home = {
        enable = lib.mkEnableOption ''
          HM profile root for this flake (bash on by default). Wire other `wisdom*` modules in
          `home.users.<name>.extraModules` and flip their `chiasson.home.*.enable` options on the host.
        '' // {
          default = true;
        };

        extraPackages = lib.mkOption {
          type = lib.types.listOf lib.types.package;
          default = [ ];
          description = ''
            Extra `home.packages` (e.g. `pkgs.parsec-bin`) when you do not want a separate wisdom module.
          '';
        };
      };

      config = lib.mkIf cfg.enable { home.packages = cfg.extraPackages; };
    };
}
