{ lib, config, pkgs, ... }:

with lib;

let
  cfg = config.roles.desktop;
in
{
  config = mkMerge [
    (mkIf (cfg.enable && cfg.gaming.enable) {
      environment.systemPackages = with pkgs; [
        lutris
        moonlight

        # Emulators
        dolphin-emu

        # Re-enabled in 25.11 after binary build was fixed
        dolphin-emu-primehack

        # Experimenting with just using the steam version + downloading
        # indiviudal cores
        #retroarch-full
        ryubing

        yarg
      ];

      programs.steam = {
        enable = true;
        remotePlay.openFirewall = true;
        dedicatedServer.openFirewall = true;
        localNetworkGameTransfers.openFirewall = true;
      };
    })
  ];
}
