Jump to content

Sunshine: Difference between revisions

From Official NixOS Wiki
Sandro (talk | contribs)
Drop Attribution, the reddit post is more fitting for the PR that got merged as a nixos module. It has not much to do with the current wiki page.
Dmchmk (talk | contribs)
Added workaround for running Steam Big Picture on Wayland
Line 14: Line 14:
   };
   };
</nowiki>}}
</nowiki>}}


== Connecting to the host ==
== Connecting to the host ==
Line 30: Line 29:
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 <code>https://localhost:47990</code>
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 <code>https://localhost:47990</code>


== Troubleshooting ==
=== Running Steam Big Picture on Wayland ===
While using Wayland on non-wlroots compositors, [https://docs.lizardbyte.dev/projects/sunshine/latest/md_docs_2getting__started.html you need to have] <code>capSysAdmin = true;</code> in Sunshine config for KMS to capture screen properly. But this parameter breaks any custom applications that should be started from your main user, not super-user. To avoid such issues, you need to prepend all needed commands with <code>sudo -u <username></code> <ref>https://discourse.nixos.org/t/give-user-cap-sys-admin-p-capabillity/62611/3?u=dmchmk</ref>:
Before: <syntaxhighlight lang="json">
    {
      "name": "Steam Big Picture",
      "detached": [
        "setsid steam steam://open/bigpicture"
      ],
      "prep-cmd": [
        {
          "do": "",
          "undo": "setsid steam steam://close/bigpicture"
        }
      ],
      "image-path": "steam.png"
    }
</syntaxhighlight>After: <syntaxhighlight lang="json">
    {
      "name": "Steam Big Picture",
      "detached": [
        "sudo -u venya setsid steam steam://open/bigpicture"
      ],
      "prep-cmd": [
        {
          "do": "",
          "undo": "sudo -u venya setsid steam steam://close/bigpicture"
        }
      ],
      "image-path": "steam.png"
    }
</syntaxhighlight>
[[Category:Applications]]
[[Category:Applications]]
[[Category:Gaming]]
[[Category:Gaming]]

Revision as of 18:29, 11 March 2026

This page is intended to explain how to use Sunshine, an open-source implementation of NVIDIA’s GameStream protocol.

Install

To install Sunshine and enable it you can use the following snippet:

❄︎ /etc/nixos/configuration.nix
  services.sunshine = {
    enable = true;
    autoStart = true;
    capSysAdmin = true; # only needed for Wayland -- omit this when using with Xorg
    openFirewall = true;
  };

Connecting to the host

When installed via the NixOS module, Sunshine is configured as a Systemd user unit, and will start automatically on login to a graphical session. Note that a logout/login or restart may be required for Sunshine to start after initially adding it to your configuration due to limitations of NixOS' handling of user units with nixos-rebuild.

If services.sunshine.autoStart is set to false, Sunshine needs to be started with the sunshine command.

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 https://localhost:47990

Troubleshooting

Running Steam Big Picture on Wayland

While using Wayland on non-wlroots compositors, you need to have capSysAdmin = true; in Sunshine config for KMS to capture screen properly. But this parameter breaks any custom applications that should be started from your main user, not super-user. To avoid such issues, you need to prepend all needed commands with sudo -u <username> [1]:

Before:

    {
      "name": "Steam Big Picture",
      "detached": [
        "setsid steam steam://open/bigpicture"
      ],
      "prep-cmd": [
        {
          "do": "",
          "undo": "setsid steam steam://close/bigpicture"
        }
      ],
      "image-path": "steam.png"
    }

After:

    {
      "name": "Steam Big Picture",
      "detached": [
        "sudo -u venya setsid steam steam://open/bigpicture"
      ],
      "prep-cmd": [
        {
          "do": "",
          "undo": "sudo -u venya setsid steam steam://close/bigpicture"
        }
      ],
      "image-path": "steam.png"
    }