Created
April 8, 2023 06:03
-
-
Save whazor/7a078e2a60bf5e02c904c741e9ac6d15 to your computer and use it in GitHub Desktop.
Running sunshine on nix as service
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{pkgs, ...}: { | |
services.udev.enable = true; | |
services.udev.extraRules = '' | |
# Your rule goes here | |
KERNEL=="uinput", GROUP="input", MODE="0660", OPTIONS+="static_node=uinput" | |
''; | |
security.wrappers = { | |
sunshine = { | |
source = "${pkgs.sunshine}/bin/sunshine"; | |
capabilities = "cap_sys_admin+ep"; | |
owner = "root"; | |
group = "root"; | |
}; | |
}; | |
systemd.user.services.sunshine = { | |
script = "/run/current-system/sw/bin/env /run/wrappers/bin/sunshine"; | |
unitConfig = { | |
Description = "Sunshine is a Game stream host for Moonlight."; | |
StartLimitIntervalSec = 500; | |
StartLimitBurst = 5; | |
}; | |
serviceConfig = { | |
Environment = "WAYLAND_DISPLAY=wayland-1"; | |
# auto restart | |
Restart = "on-failure"; | |
RestartSec = "5s"; | |
}; | |
wantedBy = [ | |
"graphical-session.target" | |
]; | |
}; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment