sunshine: use nvfbc
This commit is contained in:
parent
98d2e39d28
commit
04f1d5a42b
@ -1,15 +1,14 @@
|
|||||||
{ config, pkgs, ... }:
|
{ config, pkgs, ... }:
|
||||||
|
|
||||||
let
|
let
|
||||||
# nvidia-patch
|
rev = "c4388cf"; # revision from https://github.com/keylase/nvidia-patch to use
|
||||||
rev = "b63013c"; # revision from https://github.com/keylase/nvidia-patch to use
|
hash = "sha256-ua6LpbV3ymR22hAT2AZenoMXDqr3DUJ1wtBi/Psypow="; # sha256sum for https://github.com/keylase/nvidia-patch at the specified revision
|
||||||
hash = "sha256-EDPoMTj3J1f/7Sv/q7P/lZ4r2aXOCdsbZ4FumbvuCWk="; # sha256sum for https://github.com/keylase/nvidia-patch at the specified revision
|
|
||||||
|
|
||||||
# create patch functions for the specified revision
|
# create patch functions for the specified revision
|
||||||
nvidia-patch = pkgs.nvidia-patch rev hash;
|
nvidia-patch = pkgs.nvidia-patch rev hash;
|
||||||
|
|
||||||
# nvidia package to patch
|
# nvidia package to patch
|
||||||
nvidiaPackage = config.boot.kernelPackages.nvidiaPackages.stable;
|
nvidiaPackage = config.boot.kernelPackages.nvidiaPackages.latest;
|
||||||
|
|
||||||
user = "sunshine";
|
user = "sunshine";
|
||||||
resolutionScript = pkgs.writeTextFile {
|
resolutionScript = pkgs.writeTextFile {
|
||||||
@ -35,19 +34,23 @@ let
|
|||||||
xrandr --output DP-0 --primary --mode ''${mode_alias} --pos 0x0 --rotate normal
|
xrandr --output DP-0 --primary --mode ''${mode_alias} --pos 0x0 --rotate normal
|
||||||
|
|
||||||
/run/current-system/sw/bin/nvidia-settings -a 'SyncToVBlank=0'
|
/run/current-system/sw/bin/nvidia-settings -a 'SyncToVBlank=0'
|
||||||
|
/run/current-system/sw/bin/nvidia-smi --persistence-mode=ENABLED
|
||||||
'';
|
'';
|
||||||
executable = true;
|
executable = true;
|
||||||
destination = "/bin/resolution.sh";
|
destination = "/bin/resolution.sh";
|
||||||
};
|
};
|
||||||
configFile = pkgs.writeText "sunshine.conf"
|
configFile = pkgs.writeText "sunshine.conf"
|
||||||
''
|
''
|
||||||
output_name=1
|
capture=nvfbc
|
||||||
|
encoder=nvenc
|
||||||
|
wan_encryption_mode = 0
|
||||||
|
lan_encryption_mode = 0
|
||||||
origin_web_ui_allowed=lan
|
origin_web_ui_allowed=lan
|
||||||
channels=2
|
channels=2
|
||||||
min_threads=12
|
min_threads=12
|
||||||
global_prep_cmd=[{"do":"${pkgs.bash}/bin/bash -c \"${resolutionScript}/bin/resolution.sh ''${SUNSHINE_CLIENT_WIDTH} ''${SUNSHINE_CLIENT_HEIGHT} ''${SUNSHINE_CLIENT_FPS}\""}]
|
global_prep_cmd=[{"do":"${pkgs.bash}/bin/bash -c \"${resolutionScript}/bin/resolution.sh ''${SUNSHINE_CLIENT_WIDTH} ''${SUNSHINE_CLIENT_HEIGHT} ''${SUNSHINE_CLIENT_FPS}\""}]
|
||||||
'';
|
'';
|
||||||
sunshineOverride = pkgs.unstablePkgs.sunshine.override { cudaSupport = true; };
|
sunshinePkg = pkgs.unstablePkgs.sunshine.override { cudaSupport = true; };
|
||||||
in
|
in
|
||||||
{
|
{
|
||||||
security = {
|
security = {
|
||||||
@ -62,22 +65,29 @@ in
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
'';
|
'';
|
||||||
|
rtkit.enable = true;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
environment.systemPackages = with pkgs; [
|
environment.systemPackages = with pkgs; [
|
||||||
sunshineOverride
|
sunshinePkg
|
||||||
xorg.xrandr
|
xorg.xrandr
|
||||||
xorg.xorgserver
|
xorg.xorgserver
|
||||||
xorg.libxcvt
|
xorg.libxcvt
|
||||||
gamemode
|
gamemode
|
||||||
];
|
];
|
||||||
|
|
||||||
|
environment.variables = {
|
||||||
|
VDPAU_DRIVER = "nvidia";
|
||||||
|
LIBVA_DRIVER_NAME = "nvidia";
|
||||||
|
NVD_BACKEND = "direct";
|
||||||
|
};
|
||||||
|
|
||||||
sound.enable = true;
|
sound.enable = true;
|
||||||
|
|
||||||
services.xserver = {
|
services.xserver = {
|
||||||
enable = true;
|
enable = true;
|
||||||
videoDrivers = [ "nvidia" ];
|
videoDrivers = [ "nvidia" ];
|
||||||
|
|
||||||
displayManager = {
|
displayManager = {
|
||||||
sddm = {
|
sddm = {
|
||||||
enable = true;
|
enable = true;
|
||||||
@ -155,7 +165,7 @@ in
|
|||||||
after = [ "graphical-session.target" ];
|
after = [ "graphical-session.target" ];
|
||||||
path = with pkgs; [ resolutionScript xorg.xrandr bash xorg.libxcvt xorg.xorgserver gawk gamemode ];
|
path = with pkgs; [ resolutionScript xorg.xrandr bash xorg.libxcvt xorg.xorgserver gawk gamemode ];
|
||||||
serviceConfig = {
|
serviceConfig = {
|
||||||
ExecStart = "${sunshineOverride}/bin/sunshine ${configFile}";
|
ExecStart = "${sunshinePkg}/bin/sunshine ${configFile}";
|
||||||
Restart = "on-failure";
|
Restart = "on-failure";
|
||||||
RestartSec = "5s";
|
RestartSec = "5s";
|
||||||
};
|
};
|
||||||
@ -165,6 +175,10 @@ in
|
|||||||
services.avahi.publish.userServices = true;
|
services.avahi.publish.userServices = true;
|
||||||
boot.kernelModules = [ "uinput" ];
|
boot.kernelModules = [ "uinput" ];
|
||||||
|
|
||||||
|
services.udev.extraRules = ''
|
||||||
|
KERNEL=="uinput", SUBSYSTEM=="misc", OPTIONS+="static_node=uinput", TAG+="uaccess"
|
||||||
|
'';
|
||||||
|
|
||||||
programs.steam.enable = true;
|
programs.steam.enable = true;
|
||||||
|
|
||||||
hardware = {
|
hardware = {
|
||||||
@ -182,6 +196,7 @@ in
|
|||||||
open = false;
|
open = false;
|
||||||
nvidiaSettings = true;
|
nvidiaSettings = true;
|
||||||
package = nvidia-patch.patch-nvenc (nvidia-patch.patch-fbc nvidiaPackage);
|
package = nvidia-patch.patch-nvenc (nvidia-patch.patch-fbc nvidiaPackage);
|
||||||
|
# package = config.boot.kernelPackages.nvidiaPackages.production;
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user