···11{
22 pkgs,
33+ lib,
34 config,
45 inputs,
56 ...
···3334 profile = ''
3435 export SSL_CERT_FILE="${pkgs.cacert}/etc/ssl/certs/ca-bundle.crt"
3536 export GIO_MODULE_DIR="${pkgs.glib-networking}/lib/gio/modules/"
3737+ export __GLX_VENDOR_LIBRARY_NAME=nvidia
3638 '';
37393840 extraPkgs =
···6264 cp -r ${appimage-contents}/usr/share/icons $out/share/
6365 fi
6466 '';
6767+ # Steam/gamescope calls steamos-session-select when the user presses
6868+ # "Switch to Desktop". Without this script, the button does nothing.
6969+ # Returning 0 lets gamescope proceed to exit, returning to greetd/regreet.
7070+ steamos-session-select = pkgs.writeShellScriptBin "steamos-session-select" ''
7171+ echo "Switching session to: $1"
7272+ '';
7373+7474+ # Pin gamescope to 3.14.29 — versions 3.15+ crash on NVIDIA due to
7575+ # a confirmed driver bug (#5701801) in Vulkan YCbCr sampler pipeline compilation.
7676+ gamescope_3_14 = pkgs.gamescope.overrideAttrs (old: {
7777+ version = "3.14.29";
7878+ src = pkgs.fetchFromGitHub {
7979+ owner = "ValveSoftware";
8080+ repo = "gamescope";
8181+ tag = "3.14.29";
8282+ fetchSubmodules = true;
8383+ hash = "sha256-q3HEbFqUeNczKYUlou+quxawCTjpM5JNLrML84tZVYE=";
8484+ };
8585+ # Drop the system-libraries fetchpatch (3rd patch) — only applies to 3.16.x
8686+ patches = lib.take 2 (old.patches or []);
8787+ # 3.14.29 uses pkg-config for glm/stb, not meson subprojects
8888+ mesonFlags = builtins.filter
8989+ (f: builtins.match ".*glm_include_dir.*" f == null
9090+ && builtins.match ".*stb_include_dir.*" f == null)
9191+ (old.mesonFlags or []);
9292+ # Fix vendored OpenVR CMakeLists.txt requiring CMake < 3.5 (incompatible with CMake 4.x)
9393+ env = (old.env or { }) // { CMAKE_POLICY_VERSION_MINIMUM = "3.5"; };
9494+ # default_extras_install.sh doesn't exist in 3.14.29;
9595+ # also provide glm/stb as meson subprojects pointing to system packages
9696+ postPatch = builtins.replaceStrings
9797+ [ "patchShebangs default_extras_install.sh" ] [ "" ]
9898+ (old.postPatch or "")
9999+ + ''
100100+ rm -rf subprojects/glm subprojects/glm.wrap subprojects/stb subprojects/stb.wrap
101101+ mkdir -p subprojects/glm subprojects/stb
102102+103103+ cat > subprojects/glm/meson.build << 'GLMEOF'
104104+ project('glm', 'cpp', version: '1.0.0')
105105+ glm_dep = declare_dependency(include_directories: include_directories('${lib.getInclude pkgs.glm}/include', is_system: true))
106106+ meson.override_dependency('glm', glm_dep)
107107+ GLMEOF
108108+109109+ cat > subprojects/stb/meson.build << 'STBEOF'
110110+ project('stb', 'c', version: '0.0.1')
111111+ stb_dep = declare_dependency(include_directories: include_directories('${lib.getInclude pkgs.stb}/include/stb', is_system: true))
112112+ meson.override_dependency('stb', stb_dep)
113113+ STBEOF
114114+ '';
115115+ });
65116in
66117{
67118 imports = [
···338389 };
339390 };
340391392392+ # Frigate manages many ffmpeg child processes that ignore SIGTERM;
393393+ # shorten the stop timeout so it doesn't block shutdown for 90s.
394394+ systemd.services.frigate.serviceConfig = {
395395+ TimeoutStopSec = 5;
396396+ KillMode = "mixed"; # SIGTERM to main, SIGKILL to children after timeout
397397+ };
398398+341399 # Home Assistant service
342400 services.home-assistant = {
343401 enable = true;
···477535 ];
478536 };
479537538538+ # NVIDIA needs GBM/EGL env vars for cage (wlroots) to initialize GPU on greetd restart
539539+ services.greetd.settings.default_session.command = lib.mkOverride 49
540540+ "${pkgs.dbus}/bin/dbus-run-session ${lib.getExe pkgs.cage} -s -d -- env GBM_BACKEND=nvidia-drm __GLX_VENDOR_LIBRARY_NAME=nvidia GDK_SCALE=2 ${lib.getExe pkgs.greetd.regreet}";
541541+542542+ programs.steam = {
543543+ enable = true;
544544+ remotePlay.openFirewall = true;
545545+ gamescopeSession = {
546546+ enable = true;
547547+ args = [
548548+ "-r" "120"
549549+ "-R" "120"
550550+ ];
551551+ env = {
552552+ STEAM_DESKTOP_SESSION = "niri";
553553+ ENABLE_GAMESCOPE_WSI = "0";
554554+ };
555555+ };
556556+ extraCompatPackages = with pkgs; [
557557+ proton-ge-bin
558558+ ];
559559+ };
560560+561561+ programs.gamemode.enable = true;
562562+563563+ programs.gamescope = {
564564+ enable = true;
565565+ capSysNice = false;
566566+ package = gamescope_3_14;
567567+ };
568568+569569+ # Manually add the gamescope capability wrapper without triggering
570570+ # the steam module's setuid bwrap override (which zeros CapBnd
571571+ # inside the FHS sandbox, preventing games from launching)
572572+ security.wrappers.gamescope = {
573573+ owner = "root";
574574+ group = "root";
575575+ source = "${gamescope_3_14}/bin/gamescope";
576576+ capabilities = "cap_sys_nice+pie";
577577+ };
578578+480579 environment.systemPackages = [
481580 pkgs.lm_sensors
482581 bambu-studio
582582+ steamos-session-select
483583 ];
484584485585 # Enable the OpenSSH daemon.
+5-3
hosts/mira/hardware-configuration.nix
···8484 hardware.nvidia = {
8585 modesetting.enable = true;
8686 powerManagement.enable = true;
8787- open = true; # recommended for Turing+
8787+ open = true;
8888 nvidiaSettings = true;
8989 package = config.boot.kernelPackages.nvidiaPackages.stable;
9090 };
···9595 # still possible to use this option, but it's recommended to use it in conjunction
9696 # with explicit per-interface declarations with `networking.interfaces.<interface>.useDHCP`.
9797 networking.useDHCP = lib.mkDefault true;
9898- # Disable USB Ethernet (connected via switch causing WiFi issues)
9999- networking.interfaces.enp0s20f0u4u3.useDHCP = false;
9898+ # Disable USB Ethernet (connected via switch causing WiFi issues).
9999+ # Using networkmanager unmanaged instead of networking.interfaces to
100100+ # avoid generating a systemd device unit that blocks boot for 90s.
101101+ networking.networkmanager.unmanaged = [ "enp0s20f0u4u3" ];
100102 # networking.interfaces.enp3s0.useDHCP = lib.mkDefault true;
101103 # networking.interfaces.wlo1.useDHCP = lib.mkDefault true;
102104