mirror of
https://github.com/ryan4yin/nix-config.git
synced 2026-09-11 20:41:44 +02:00
fix(sunshine): use Intel rendering and recover remote Niri sessions (#268)
- render Niri on the Intel iGPU while retaining NVIDIA-connected physical outputs - encode Sunshine streams with Intel VAAPI and wait for a Niri output before startup - load VKMS persistently for headless sessions and configure `Virtual-1` at 2560x1600@60 - let Moonlight request the stream bitrate instead of enforcing a 20 Mbps host cap - remove unsupported Dynamic Boost and global NVIDIA session overrides - grant Sunshine access to virtual input devices - add a Nushell recovery helper that starts a temporary greetd/Niri session from SSH - identify and safely replace normal, standalone, or previous transient Niri sessions - launch the transient service in the background and verify greetd, Niri, and Sunshine before returning - ignore local `.worktrees` directories and keep eval regression coverage focused on structural behavior
This commit is contained in:
@@ -1,6 +1,5 @@
|
||||
{
|
||||
config,
|
||||
lib,
|
||||
pkgs,
|
||||
...
|
||||
}:
|
||||
@@ -42,8 +41,6 @@
|
||||
# required by most wayland compositors!
|
||||
modesetting.enable = true;
|
||||
powerManagement.enable = true;
|
||||
|
||||
dynamicBoost.enable = lib.mkForce true;
|
||||
};
|
||||
|
||||
hardware.nvidia-container-toolkit.enable = true;
|
||||
@@ -54,9 +51,23 @@
|
||||
};
|
||||
|
||||
services.sunshine.settings = {
|
||||
max_bitrate = 20000; # in Kbps
|
||||
# NVIDIA NVENC Encoder
|
||||
nvenc_preset = 3; # 1(fastest + worst quality) - 7(slowest + best quality)
|
||||
nvenc_twopass = "full_res"; # quarter_res / full_res.
|
||||
adapter_name = "/dev/dri/by-path/pci-0000:00:02.0-render"; # Intel iGPU
|
||||
encoder = "vaapi";
|
||||
};
|
||||
|
||||
systemd.user.services.sunshine = {
|
||||
after = [ "niri.service" ];
|
||||
environment.LIBVA_DRIVER_NAME = "iHD";
|
||||
preStart = ''
|
||||
for _ in {1..20}; do
|
||||
if ${config.programs.niri.package}/bin/niri msg outputs | ${pkgs.gnugrep}/bin/grep -q '^Output '; then
|
||||
exit 0
|
||||
fi
|
||||
sleep 0.5
|
||||
done
|
||||
|
||||
echo "Sunshine requires at least one Niri output" >&2
|
||||
exit 1
|
||||
'';
|
||||
};
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user