{ 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"; useGamescope = mkEnableOption "Enable Gamescope, a tool to run games in a separate X session"; }; config = mkIf cfg.enable { programs.steam = { enable = true; package = pkgs.steam.override { # required for programs to run sometimes # see: https://github.com/NixOS/nixpkgs/issues/162562#issuecomment-1229444338 extraPkgs = (pkgs: (lib.optional cfg.useGamescope pkgs.gamescope) ++ (with pkgs; [ xorg.libXcursor xorg.libXi xorg.libXinerama xorg.libXScrnSaver libpng libpulseaudio libvorbis stdenv.cc.cc.lib libkrb5 keyutils ])); }; extraCompatPackages = with pkgs; [ proton-ge-bin ]; protontricks.enable = true; localNetworkGameTransfers.openFirewall = true; remotePlay.openFirewall = true; dedicatedServer.openFirewall = true; }; programs.gamescope = { enable = true; # capSysNice = true; https://github.com/NixOS/nixpkgs/issues/351516 }; user.packages = with pkgs; [ steam-run ]; }; }