{ lib, config, pkgs, namespace, ... }: let cfg = config.${namespace}.gaming; in { imports = [ ./options.nix ]; config = lib.mkIf cfg.enable { # Network option required using sysctl to let Ubisoft Connect work as of 7-12-2023 # Use mkDefault so jovian-nixos steam module (which sets this to `true`) wins. boot.kernel.sysctl."net.ipv4.tcp_mtu_probing" = lib.mkDefault 1; # Configure programs programs.steam = { enable = true; package = pkgs.steam.override { extraPkgs = _pkgs: with pkgs; [ libXcursor libXi libXinerama libXScrnSaver libpng libpulseaudio libvorbis stdenv.cc.cc.lib libkrb5 keyutils ]; }; # Open ports in the firewall for Steam Remote Play remotePlay.openFirewall = true; # Open ports in the firewall for Source Dedicated Server dedicatedServer.openFirewall = true; extraCompatPackages = with pkgs.unstable; [ proton-ge-bin ] ++ (with pkgs.${namespace}; [ proton-cachyos proton-cachyos-v3 proton-cachyos-v2 proton-cachyos-v1 ]); gamescopeSession = lib.mkDefault { enable = true; args = [ "-f" "-H 2160" "-W 3840" "-r 240" "--hdr-enabled" "--adaptive-sync" ]; }; }; # "gamescope -f -H 2160 -W 3840 -r 240 --adaptive-sync --hdr-enabled programs = { alvr = { enable = true; openFirewall = true; package = pkgs.alvr; }; gamescope = { enable = true; # Set capSysNice = false so programs.gamescope does not create its own # security.wrappers.gamescope, which conflicts with the wrapper set by # jovian-nixos steam module (which already enables cap_sys_nice+pie). capSysNice = false; }; gamemode.enable = true; }; # Hardware configs hardware = { # Xbox controllers xpadneo.enable = false; # Steam udev rules for remote play steam-hardware.enable = true; }; environment = { systemPackages = with pkgs.${namespace}; [ ]; variables = { STEAM_FORCE_DESKTOPUI_SCALING = "1.0"; }; }; }; }