{ pkgs, lib, ... }: let 
  _gamescope = pkgs.gamescope.overrideAttrs (final: prev: {
    src = pkgs.fetchFromGitHub {
      owner = "ValveSoftware";
      repo = "gamescope";
      rev = "186f3a3ed0ce8eb5f3a956d3916a3331ea4e3ab2";
      fetchSubmodules = true;
      hash = "sha256-zAzIi3syJYtbKjydp19d1OxZvMjXb+eO+mXT/mJPEuA=";
    };
  }); 
in {
  programs.steam = {
    enable = true;
    package = pkgs.steam;
    extraPackages = with pkgs; [
      libkrb5
      keyutils
      gamemode
      mangohud
      _gamescope
    ];
    extraCompatPackages = with pkgs; [
      proton-ge-bin
    ];
    remotePlay.openFirewall = true;
    protontricks.enable = true;
  };

  programs.gamescope = {
    enable = true;
    package = _gamescope;
  };
}
