{
  config,
  lib,
  pkgs,
  ...
}:
let
  cfg = config.modules.greetd;
  tuigreet = "${pkgs.tuigreet}/bin/tuigreet";
in
{
  options.modules.greetd = {
    enable = lib.mkEnableOption "Greetd configuration module";
  };
  config = lib.mkIf cfg.enable {
    services.greetd = {
      enable = true;
      settings = {
        default_session = {
          command = "${tuigreet} --time --remember --cmd start-hyprland";
          user = "greeter";
        };
      };
    };
    systemd.services.greetd.serviceConfig = {
      Type = "idle";
      StandardInput = "tty";
      StandardOutput = "tty";
      StandardError = "journal";

      TTYReset = true;
      TTYVHangup = true;
      TTYVTDisallocate = true;
    };
  };
}
