103 lines
2.2 KiB
Nix
103 lines
2.2 KiB
Nix
{
|
|
pkgs,
|
|
inputs,
|
|
lib,
|
|
config,
|
|
...
|
|
}:
|
|
{
|
|
imports = [
|
|
./gui.nix
|
|
./desktop.nix
|
|
];
|
|
|
|
home.packages = with pkgs; [
|
|
protontricks
|
|
|
|
# https://github.com/NixOS/nixpkgs/pull/339370#issuecomment-2731336341
|
|
bs-manager
|
|
|
|
# Steam session scripts
|
|
(writeShellScriptBin "steam-session" ''
|
|
#!/usr/bin/env bash
|
|
set -xeuo pipefail
|
|
|
|
gamescopeArgs=(
|
|
--adaptive-sync # VRR support
|
|
--hdr-enabled
|
|
--mangoapp # performance overlay
|
|
--rt
|
|
--steam
|
|
)
|
|
|
|
steamArgs=(
|
|
-pipewire-dmabuf
|
|
-tenfoot
|
|
)
|
|
|
|
mangoConfig=(
|
|
cpu_temp
|
|
gpu_temp
|
|
ram
|
|
vram
|
|
)
|
|
|
|
mangoVars=(
|
|
MANGOHUD=1
|
|
MANGOHUD_CONFIG="$(IFS=,; echo "''${mangoConfig[*]}")"
|
|
)
|
|
|
|
export "''${mangoVars[@]}"
|
|
exec gamescope "''${gamescopeArgs[@]}" -- steam "''${steamArgs[@]}"
|
|
'')
|
|
|
|
(writeShellScriptBin "steam-session-greetd" ''
|
|
#!/usr/bin/env bash
|
|
set -xeuo pipefail
|
|
|
|
# Set environment variables for Steam gaming session
|
|
export STEAM_RUNTIME=1
|
|
export SDL_VIDEODRIVER=wayland
|
|
export QT_QPA_PLATFORM=wayland
|
|
export GDK_BACKEND=wayland
|
|
export XDG_CURRENT_DESKTOP=Steam
|
|
export XDG_SESSION_TYPE=wayland
|
|
|
|
# Kill any existing compositor
|
|
pkill niri || true
|
|
|
|
# Start Steam in Big Picture mode with gamescope
|
|
exec steam-session
|
|
'')
|
|
];
|
|
|
|
# Create desktop entry for Steam session
|
|
xdg.dataFile."wayland-sessions/steam-session.desktop".text = ''
|
|
[Desktop Entry]
|
|
Name=Steam Session
|
|
Comment=Steam Deck-like gaming session with gamescope
|
|
Exec=${config.home.homeDirectory}/.nix-profile/bin/steam-session-greetd
|
|
Type=Application
|
|
DesktopNames=steam
|
|
'';
|
|
|
|
# Create desktop entry for Niri session
|
|
xdg.dataFile."wayland-sessions/niri-session.desktop".text = ''
|
|
[Desktop Entry]
|
|
Name=Niri Session
|
|
Comment=Niri Wayland compositor
|
|
Exec=${config.programs.niri.package}/bin/niri-session
|
|
Type=Application
|
|
DesktopNames=niri
|
|
'';
|
|
|
|
programs.obs-studio = {
|
|
enable = true;
|
|
plugins = with pkgs.obs-studio-plugins; [
|
|
wlrobs
|
|
obs-backgroundremoval
|
|
obs-pipewire-audio-capture
|
|
];
|
|
};
|
|
}
|