{ config, lib, pkgs, ... }: let cfgUser = "dominik"; # Adjust to your username in { environment.etc."steam-deck-mode.sh".text = '' #!/usr/bin/env bash # Launches Steam in Big Picture with Gamescope. # On exit, user service stops, triggering ExecStopPost to start GNOME. pgrep steam && steam -shutdown || true sleep 1 exec gamescope -W 1280 -H 800 -f -e -- steam -gamepadui ''; environment.etc."gnome-session.sh".text = '' #!/usr/bin/env bash # Start a GNOME session exec gnome-session ''; systemd.services."make-scripts-executable" = { description = "Make steam-deck-mode and gnome-session scripts executable"; wantedBy = [ "multi-user.target" ]; serviceConfig.ExecStart = [ "${pkgs.coreutils}/bin/chmod +x /etc/steam-deck-mode.sh" "${pkgs.coreutils}/bin/chmod +x /etc/gnome-session.sh" ]; }; # Steam Deck Mode service systemd.user.services."steam-deck-mode" = { description = "Steam Deck Mode (Gamescope + Steam Big Picture)"; wantedBy = [ "default.target" ]; serviceConfig = { Type = "simple"; ExecStart = "/etc/steam-deck-mode.sh"; ExecStopPost = "${pkgs.systemd}/bin/systemctl --user start gnome-session"; Restart = "no"; }; }; # GNOME Session (Wayland) service systemd.user.services."gnome-session" = { description = "GNOME Session (Wayland)"; wantedBy = [ ]; serviceConfig = { Type = "simple"; ExecStart = "/etc/gnome-session.sh"; ExecStopPost = "${pkgs.systemd}/bin/systemctl --user start steam-deck-mode"; Restart = "no"; }; }; # Quick script to switch from GNOME to Steam Big Picture environment.etc."switch-to-game-mode.sh".text = '' #!/usr/bin/env bash # Stop GNOME => triggers Steam in ExecStopPost ${pkgs.systemd}/bin/systemctl --user stop gnome-session ''; systemd.services."make-switch-to-game-mode-executable" = { description = "Make switch-to-game-mode.sh executable"; wantedBy = [ "multi-user.target" ]; serviceConfig.ExecStart = [ "${pkgs.coreutils}/bin/chmod +x /etc/switch-to-game-mode.sh" ]; }; environment.etc."xdg/applications/switch-to-game-mode.desktop".text = '' [Desktop Entry] Name=Switch to Game Mode Comment=Stop GNOME and start Steam (Gamescope) Exec=/etc/switch-to-game-mode.sh Terminal=false Type=Application Categories=Game; ''; # Update to new hardware.graphics.* options hardware.graphics.enable = true; hardware.graphics.enable32Bit = true; # Include AMD Vulkan for 64bit & 32bit hardware.graphics.extraPackages = [ pkgs.amdvlk pkgs.driversi686Linux.amdvlk ]; # A recommended set of gaming packages environment.systemPackages = with pkgs; [ steam gamemode mangohud vulkan-tools vulkan-loader vulkan-headers ]; # Move the Steam Deck controller rules to services.udev.extraRules # services.udev.extraRules = '' # SUBSYSTEM=="usb", ATTRS{idVendor}=="28de", MODE="0666" # KERNEL=="uinput", MODE="0660", GROUP="input", OPTIONS+="static_node=uinput" # ''; }