{
  lib,
  pkgs,
  config,
  ...
}:
let
  inherit (lib) mkIf mkEnableOption;

  cfg = config.modules.system.roles.gaming;
in
{
  options.modules.system.roles.gaming = {
    enable = mkEnableOption "gaming features";
  };

  config = mkIf cfg.enable {
    programs.gamescope = {
      enable = true;
      capSysNice = true;
    };

    programs.steam = {
      enable = true;
      extest.enable = true;
      localNetworkGameTransfers.openFirewall = true;
      extraCompatPackages = with pkgs; [ proton-ge-bin ];
    };

    programs.gamemode.enable = true;

    environment.systemPackages = with pkgs; [
      mangohud
      heroic
    ];
  };
}
