{ config, lib, pkgs, namespace, ... }:
let
  inherit (lib) mkIf types;
  inherit (lib.${namespace}) mkOpt;

  cfg = config.${namespace}.display-managers.sddm;
in
{
  options.${namespace}.display-managers.sddm = {
    enable = lib.mkEnableOption "sddm";
    scale = mkOpt types.str "1.75" "Scale";
  };

  config = mkIf cfg.enable {
    services = {
      displayManager = {
        sddm = {
          inherit (cfg) enable;
          package = pkgs.kdePackages.sddm;
          #theme = "catppuccin-mocha"; # https://github.com/nixos/nixpkgs/issues/434963
          theme = "breeze";
          wayland.enable = true;
        };
      };
    };

    environment.systemPackages = with pkgs; [
      catppuccin-sddm
    ];

    environment.sessionVariables = {
      QT_SCREEN_SCALE_FACTORS = cfg.scale;
    };
  };
}
