Sunshine: Difference between revisions

Devusb (talk | contribs)
added notes around capSysAdmin with Xorg and autostart behavior
Dmchmk (talk | contribs)
No edit summary
 
(5 intermediate revisions by 3 users not shown)
Line 13: Line 13:
     openFirewall = true;
     openFirewall = true;
   };
   };
</nowiki>}}
For manual Firewall configuration you can open network ports as shown here:
{{file|/etc/nixos/configuration.nix|nix|<nowiki>
networking.firewall = {
  enable = true;
  allowedTCPPorts = [ 47984 47989 47990 48010 ];
  allowedUDPPortRanges = [
    { from = 47998; to = 48000; }
    { from = 8000; to = 8010; }
  ];
};
</nowiki>}}
</nowiki>}}


Line 33: Line 19:
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 <code>nixos-rebuild</code>.   
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 <code>nixos-rebuild</code>.   


If <code>services.sunshine.autoStart</code> is set to <code>false,</code> Sunshine needs to be started with the <pre>sunshine</pre> command.
If <code>services.sunshine.autoStart</code> is set to <code>false</code>, Sunshine needs to be started with the <code>sunshine</code> command.


You may have to manually add the host running Sunshine to your Moonlight client. This, thankfully, is not hard to do.
You may have to manually add the host running Sunshine to your Moonlight client. This, thankfully, is not hard to do.
Line 43: 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>


== Attribution ==
== Limitations ==
A substantial amount of the above came from [https://www.reddit.com/r/NixOS/comments/1bq2bx4/beginners_guide_to_sunshine_gamedesktop_streaming/ this fairly wonderful guide] posted to Reddit.
At the time of writing Sunshine is unable to wake sleeping display<ref>https://github.com/orgs/LizardByte/discussions/439</ref> (e.g. when screen is locked), which makes impossible to connect to the main session of your host PC. Can be somehow avoided by creating a virtual display and running Sunshine through it.
 
== 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]]