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