{
  pkgs,
  lib,
  config,
  ...
}: let
  cfg = config.desktop.greetd;
in {
  options.desktop.greetd = {
    enable = lib.mkEnableOption "enable greetd with tuigreet";
  };

  config = lib.mkIf cfg.enable {
    services.greetd = {
      enable = true;
      # tuigreet command to run
      settings = {
        default_session = {
          user = "greeter";
          command = "${pkgs.tuigreet}/bin/tuigreet -c Hyprland -t --greeting \"howdy o/\" --user-menu --remember --remember-user-session --power-shutdown \"systemctl poweroff\" --power-reboot \"systemctl reboot\"";
        };
      };
    };

    # allow yubikey signin with u2f
    security.pam.services.greetd.u2fAuth = true;

    # ensure the user exists
    users.users.greeter = {
      isSystemUser = true;
      description = "user for greetd";
    };
  };
}
