{
  lib,
  config,
  pkgs,
  ...
}: let
  cfg = config.myConfig.greetd;
  themeEnv = ''
    export XDG_DATA_DIRS="${pkgs.whitesur-gtk-theme}/share:$XDG_DATA_DIRS"
    export XDG_DATA_DIRS="${pkgs.whitesur-icon-theme}/share:$XDG_DATA_DIRS"
    export XDG_DATA_DIRS="${pkgs.whitesur-cursors}/share:$XDG_DATA_DIRS"
  '';
in {
  options.myConfig.greetd = {
    enable = lib.mkEnableOption "greetd, a light weight greater deamon";
  };

  config = lib.mkIf cfg.enable {
    environment.extraInit = themeEnv;
    programs.regreet = {
      enable = true;
      settings = {
        background = {
          fit = "Contain";
          path = ../../assets/bg4k.png;
        };
        GTK = {
          application_prefer_dark_theme = true;
          cursor_theme_name = lib.mkForce "capitaine-cursors-white";
          font_name = lib.mkForce "FiraCode Nerd Font 20";
          icon_theme_name = lib.mkForce "WhiteSur-dark";
          theme_name = lib.mkForce "WhiteSur-Dark";
        };
        commands = {
          reboot = ["systemctl" "reboot"];
          poweroff = ["systemctl" "poweroff"];
        };
      };
    };

    users.users.greeter = {
      isNormalUser = false;
      description = "Greeter";
      extraGroups = [];
    };

    services.greetd.enable = true;

    environment.etc."greetd/environments".text = ''
      sway
    '';

    environment.systemPackages = with pkgs; [
      whitesur-gtk-theme
      whitesur-icon-theme
      whitesur-cursors
    ];
  };
}
