me like nix
0

Configure Feed

Select the types of activity you want to include in your feed.

1{ ... }: { 2 flake.modules.nixos.gaming = 3 { pkgs, lib, ... }: 4 let 5 # Steam/gamescope calls steamos-session-select when the user presses 6 # "Switch to Desktop". Without this script, the button does nothing. 7 steamos-session-select = pkgs.writeShellScriptBin "steamos-session-select" '' 8 echo "Switching session to: $1" 9 ''; 10 11 # Pin gamescope to 3.14.29 — versions 3.15+ crash on NVIDIA due to 12 # a confirmed driver bug (#5701801) in Vulkan YCbCr sampler pipeline compilation. 13 gamescope_3_14 = pkgs.gamescope.overrideAttrs (old: { 14 version = "3.14.29"; 15 src = pkgs.fetchFromGitHub { 16 owner = "ValveSoftware"; 17 repo = "gamescope"; 18 tag = "3.14.29"; 19 fetchSubmodules = true; 20 hash = "sha256-q3HEbFqUeNczKYUlou+quxawCTjpM5JNLrML84tZVYE="; 21 }; 22 patches = lib.take 2 (old.patches or [ ]); 23 mesonFlags = builtins.filter 24 ( 25 f: 26 builtins.match ".*glm_include_dir.*" f == null 27 && builtins.match ".*stb_include_dir.*" f == null 28 ) 29 (old.mesonFlags or [ ]); 30 env = (old.env or { }) // { 31 CMAKE_POLICY_VERSION_MINIMUM = "3.5"; 32 }; 33 postPatch = 34 builtins.replaceStrings [ "patchShebangs default_extras_install.sh" ] [ "" ] ( 35 old.postPatch or "" 36 ) 37 + '' 38 rm -rf subprojects/glm subprojects/glm.wrap subprojects/stb subprojects/stb.wrap 39 mkdir -p subprojects/glm subprojects/stb 40 41 cat > subprojects/glm/meson.build << 'GLMEOF' 42 project('glm', 'cpp', version: '1.0.0') 43 glm_dep = declare_dependency(include_directories: include_directories('${lib.getInclude pkgs.glm}/include', is_system: true)) 44 meson.override_dependency('glm', glm_dep) 45 GLMEOF 46 47 cat > subprojects/stb/meson.build << 'STBEOF' 48 project('stb', 'c', version: '0.0.1') 49 stb_dep = declare_dependency(include_directories: include_directories('${lib.getInclude pkgs.stb}/include/stb', is_system: true)) 50 meson.override_dependency('stb', stb_dep) 51 STBEOF 52 ''; 53 }); 54 in 55 { 56 # ZRAM swap to prevent OOM freezes 57 zramSwap = { 58 enable = true; 59 memoryPercent = 50; 60 }; 61 62 # Kill runaway processes before the system locks up 63 services.earlyoom = { 64 enable = true; 65 freeMemThreshold = 5; 66 freeSwapThreshold = 5; 67 enableNotifications = true; 68 }; 69 70 programs.steam = { 71 enable = true; 72 remotePlay.openFirewall = true; 73 gamescopeSession = { 74 enable = true; 75 args = [ 76 "-r" 77 "120" 78 "-R" 79 "120" 80 ]; 81 env = { 82 STEAM_DESKTOP_SESSION = "niri"; 83 ENABLE_GAMESCOPE_WSI = "1"; 84 }; 85 }; 86 extraCompatPackages = with pkgs; [ 87 proton-ge-bin 88 ]; 89 }; 90 91 programs.gamemode.enable = true; 92 93 programs.gamescope = { 94 enable = true; 95 capSysNice = false; 96 package = gamescope_3_14; 97 }; 98 99 environment.systemPackages = [ 100 steamos-session-select 101 ]; 102 103 boot.kernelParams = [ "split_lock_mitigate=0" ]; 104 105 security.pam.loginLimits = [ 106 { 107 domain = "*"; 108 type = "soft"; 109 item = "nofile"; 110 value = "8192"; 111 } 112 ]; 113 }; 114}