{
  config,
  lib,
  pkgs,
  ...
}:

{
  options.modules.greetd = {
    enable = lib.mkEnableOption "Enable GreetD with TUI-based login.";
    command = lib.mkOption {
      type = lib.types.str;
      description = "Command to run after successful login";
    };
  };

  config = lib.mkIf config.modules.greetd.enable {
    services.greetd = {
      enable = true;
      settings = {
        default_session.command = "${pkgs.greetd.tuigreet}/bin/tuigreet --time --cmd ${config.modules.greetd.Command}";
      };
    };
  };
}
