{ lib, config, pkgs, ... }: with lib; let cfg = config.modules.software.distractions.steam; in { options.modules.software.distractions.steam = { enable = mkEnableOption "Enable Steam, the game distribution software"; session = mkEnableOption "Enable a Steam Deck-like session powered by gamescope"; }; config = mkIf cfg.enable { programs.steam = { enable = true; gamescopeSession.enable = cfg.session; package = pkgs.steam.override { # required for programs to run sometimes # see: https://github.com/NixOS/nixpkgs/issues/162562#issuecomment-1229444338 extraPkgs = (pkgs: with pkgs; [ libXcursor libXi libXinerama libXScrnSaver libpng libpulseaudio libvorbis stdenv.cc.cc.lib libkrb5 keyutils gperftools ]); extraEnv = { # https://github.com/gloriouseggroll/proton-ge-custom PROTON_USE_WAYLAND = "1"; PROTON_USE_WOW64 = "1"; }; }; extraCompatPackages = with pkgs; [ proton-ge-bin ]; protontricks.enable = true; # explicitly allow all the ports to open up localNetworkGameTransfers.openFirewall = true; remotePlay.openFirewall = true; dedicatedServer.openFirewall = true; }; # enable windows NT sync primitive driver (semaphores, mutexes, etc.) # improves performance on wine 11+ and proton 11+ boot.kernelModules = [ "ntsync" ]; user.packages = with pkgs; [ steam-run ]; }; }