{user}: {
  lib,
  pkgs,
  config,
  ...
}:
with lib; {
  options.roles.gamer = {
    enable = mkEnableOption "gamer packages";
  };

  config = mkIf config.roles.gamer.enable {
    # required for heroic launcher
    nixpkgs.config.permittedInsecurePackages = [
      "electron-25.9.0"
    ];

    home-manager.users.${user}.imports = [
      {
        home.packages = with pkgs; [
          # Games
          airshipper
          minetest
          superTuxKart
          xonotic

          # Helpers
          heroic
          BeatSaberModManager
          protontricks
          protonup-qt
          oversteer

          # vr
          monado
          openxr-loader
          opencomposite

          (makeDesktopItem {
            name = "x11steam";
            desktopName = "X11 Steam Wrapper";
            exec = "QT_QPA_PLATFORM=xcb SDL_VIDEODRIVER=x11 ${steam}/bin/steam";
          })
        ];
      }
    ];

    nixpkgs.config.allowUnfreePredicate = pkg:
      builtins.elem (lib.getName pkg) [
        "steam"
        "steam-run"
        "steam-original"
        "osu-lazer"
      ];

    programs.steam = {
      enable = true;
      remotePlay.openFirewall = true;
      dedicatedServer.openFirewall = true;
    };
    programs.gamemode.enable = true;
  };
}
