{ config, lib, ... }:
{
  config = lib.mkIf config.system.desktop.enable {
    programs = {
      sway.enable = true;
      niri.enable = true;
      xwayland.enable = lib.mkForce true;
    };

    environment.sessionVariables = {
      WLR_RENDERER = "vulkan";
      NIXOS_OZONE_WL = "1";
    };

    services.dbus.enable = true;
    security.pam.services.swaylock = {};

    services.displayManager.ly.settings.waylandsessions = "/etc/greetd/environments";
    environment.etc = {
      "greetd/environments/sway.desktop".text = ''
        [Desktop Entry]
        Name=Sway
        Exec=sway --unsupported-gpu
      '';
      "greetd/environments/niri.desktop".text = ''
        [Desktop Entry]
        Name=Niri
        Exec=niri-session
      '';
    };
  };
}
