Sunshine

From NixOS Wiki
Revision as of 06:29, 21 April 2024 by Mic92 (talk | contribs) (import from old wiki)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)

This page is intended to explain how to use Sunshine, an open-source implementation of Nvidia’s Moonlight game streaming application.

Install

To install Sunshine and enable to for use you will need to open up network ports as shown here:

 
/etc/nixos/configuration.nix
networking.firewall = {
  enable = true;
  allowedTCPPorts = [ 47984 47989 47990 48010 ];
  allowedUDPPortRanges = [
    { from = 47998; to = 48000; }
    { from = 8000; to = 8010; }
  ];
};

Connecting to the host

Before moving forward I would strongly recommend restarting the computer and making sure you start Sunshine once you reboot.

You may have to manually add the host running Sunshine to your Moonlight client. This, thankfully, is not hard to do.

Simply press the button that says Add Host Manually, from there you will need to input the following (replace <Host IP> with your Host’s IP address):

<Host IP>:47989

If this doesn’t work you should double check the port in the Sunshine’s WebGUI. You can access this from the Host PC in a web browser localhost:47990

If this doesn’t work, make sure Sunshine is actually running. You can do this by running sunshine in a terminal.

Troubleshooting

If once you run Sunshine you may see a lot of error messages. Some of these don’t necessarily prevent Sunshine from working, for ones that do the following section hopes to solve those problems.

Error: Failed to gain CAP_SYS_ADMIN

This can be fixed by using the code as follows:

 
/etc/nixos/configuration.nix
security.wrappers.sunshine = {
        owner = "root";
        group = "root";
        capabilities = "cap_sys_admin+p";
        source = "${pkgs.sunshine}/bin/sunshine";
 };

Error: avahi::entry_group_new() failed: Not permitted

The following lines can help with this:

 
/etc/nixos/configuration.nix
services.avahi.publish.enable = true;
services.avahi.publish.userServices = true;

Attribution

A substantial amount of the above came from this fairly wonderful guide posted to Reddit: