refactor: use sunshine service
This commit is contained in:
parent
2487717aaf
commit
f7f1da25ed
@ -30,41 +30,12 @@ let
|
||||
executable = true;
|
||||
destination = "/bin/resolution.sh";
|
||||
};
|
||||
configFile = pkgs.writeText "sunshine.conf"
|
||||
''
|
||||
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}\""}]
|
||||
'';
|
||||
sunshinePkg = (pkgs.unstablePkgs.sunshine.override { cudaSupport = true; });
|
||||
sunshinePkg = (pkgs.localPkgs.sunshine.override { cudaSupport = true; cudaPackages = pkgs.cudaPackages; boost = pkgs.unstablePkgs.boost186; });
|
||||
in
|
||||
{
|
||||
boot.kernelModules = [ "uinput" ];
|
||||
|
||||
environment = {
|
||||
systemPackages = with pkgs; [
|
||||
sunshinePkg
|
||||
xorg.xrandr
|
||||
xorg.xorgserver
|
||||
xorg.libxcvt
|
||||
gamemode
|
||||
];
|
||||
|
||||
variables = {
|
||||
VDPAU_DRIVER = "nvidia";
|
||||
LIBVA_DRIVER_NAME = "nvidia";
|
||||
NVD_BACKEND = "direct";
|
||||
__GL_SYNC_TO_VBLANK = "0";
|
||||
__GL_VRR_ALLOWED = "0";
|
||||
DXVK_ASYNC = "1";
|
||||
};
|
||||
};
|
||||
environment.systemPackages = [ pkgs.unstablePkgs.gamemode ];
|
||||
|
||||
hardware = {
|
||||
pulseaudio.enable = true;
|
||||
@ -101,15 +72,45 @@ in
|
||||
};
|
||||
|
||||
services = {
|
||||
avahi = {
|
||||
sunshine = {
|
||||
enable = true;
|
||||
publish.userServices = true;
|
||||
autoStart = true;
|
||||
package = sunshinePkg;
|
||||
settings = {
|
||||
sunshine_name = "The Architect";
|
||||
capture = "nvfbc";
|
||||
encoder = "nvenc";
|
||||
wan_encryption_mode = 0;
|
||||
lan_encryption_mode = 0;
|
||||
origin_web_ui_allowed = "lan";
|
||||
min_threads = 12;
|
||||
log_path = "sunshine.log";
|
||||
};
|
||||
applications = {
|
||||
env = {
|
||||
VDPAU_DRIVER = "nvidia";
|
||||
LIBVA_DRIVER_NAME = "nvidia";
|
||||
NVD_BACKEND = "direct";
|
||||
__GL_SYNC_TO_VBLANK = "0";
|
||||
__GL_VRR_ALLOWED = "0";
|
||||
DXVK_ASYNC = "1";
|
||||
};
|
||||
apps = [
|
||||
{
|
||||
name = "Steam";
|
||||
detached = [ "${pkgs.steam}/bin/steam" ];
|
||||
prep-cmd = [
|
||||
{
|
||||
do = "${resolutionScript}/bin/resolution.sh $SUNSHINE_CLIENT_WIDTH $SUNSHINE_CLIENT_HEIGHT $SUNSHINE_CLIENT_FPS";
|
||||
undo = "${pkgs.procps}/bin/pkill -KILL steam";
|
||||
}
|
||||
];
|
||||
auto-detach = "true";
|
||||
}
|
||||
];
|
||||
};
|
||||
};
|
||||
|
||||
udev.extraRules = ''
|
||||
KERNEL=="uinput", SUBSYSTEM=="misc", OPTIONS+="static_node=uinput", TAG+="uaccess"
|
||||
'';
|
||||
|
||||
displayManager = {
|
||||
sddm = {
|
||||
enable = true;
|
||||
@ -201,29 +202,11 @@ in
|
||||
|
||||
sound.enable = true;
|
||||
|
||||
systemd = {
|
||||
targets = {
|
||||
sleep.enable = false;
|
||||
suspend.enable = false;
|
||||
hibernate.enable = false;
|
||||
hybrid-sleep.enable = false;
|
||||
};
|
||||
|
||||
user.services.${user} = {
|
||||
description = "Sunshine server";
|
||||
wantedBy = [ "graphical-session.target" ];
|
||||
startLimitIntervalSec = 500;
|
||||
startLimitBurst = 5;
|
||||
partOf = [ "graphical-session.target" ];
|
||||
wants = [ "graphical-session.target" ];
|
||||
after = [ "graphical-session.target" ];
|
||||
path = with pkgs; [ resolutionScript gamemode ];
|
||||
serviceConfig = {
|
||||
ExecStart = "${sunshinePkg}/bin/sunshine ${configFile}";
|
||||
Restart = "on-failure";
|
||||
RestartSec = "5s";
|
||||
};
|
||||
};
|
||||
systemd.targets = {
|
||||
sleep.enable = false;
|
||||
suspend.enable = false;
|
||||
hibernate.enable = false;
|
||||
hybrid-sleep.enable = false;
|
||||
};
|
||||
|
||||
users = {
|
||||
|
Loading…
Reference in New Issue
Block a user