Skip to content

Instantly share code, notes, and snippets.

@whazor
Created April 8, 2023 06:03
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save whazor/7a078e2a60bf5e02c904c741e9ac6d15 to your computer and use it in GitHub Desktop.
Save whazor/7a078e2a60bf5e02c904c741e9ac6d15 to your computer and use it in GitHub Desktop.
Running sunshine on nix as service
{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