{ pkgs, lib, username, config, ... }:
let
  cfg = config.my.desktop;
in
{
  services.displayManager.sddm = {
    enable = cfg.sddm.enable;
    theme = "catppuccin-mocha-mauve";
    package = pkgs.kdePackages.sddm;
    wayland = {
      enable = true;
      compositor = "kwin";
    };
    settings = {
      Autologin = lib.mkIf cfg.sddm.autoLogin.enable {
        User = "${username}";
        Session = cfg.sddm.autoLogin.session;
      };
    };
  };

  environment.systemPackages =
  lib.optionals cfg.sddm.enable [(
    pkgs.catppuccin-sddm.override {
      flavor = "mocha";
      accent = "mauve";
      font  = "Noto Sans";
      fontSize = "9";
      background = "${./sddm-background/wallpaper.png}";
      loginBackground = true;
    }
  )];
}
