summary refs log tree commit diff
path: root/modules/sunshine.nix
diff options
context:
space:
mode:
authorMel <mel@rnrd.eu>2026-03-20 23:45:27 +0100
committerMel <mel@rnrd.eu>2026-03-20 23:52:34 +0100
commit5305478366e55a71e282e56a2706cdbbbcf715f0 (patch)
tree67d72cc628e7689a36dc8fa00cb4bbdfb2cb8994 /modules/sunshine.nix
parentf93545e1939d63d3b51ce34199d4bfedf64b79b5 (diff)
downloadminerals-5305478366e55a71e282e56a2706cdbbbcf715f0.tar.zst
minerals-5305478366e55a71e282e56a2706cdbbbcf715f0.zip
Add Desktop & Steam Big Picture apps to Sunshine selection
Signed-off-by: Mel <mel@rnrd.eu>
Diffstat (limited to 'modules/sunshine.nix')
-rw-r--r--modules/sunshine.nix58
1 files changed, 47 insertions, 11 deletions
diff --git a/modules/sunshine.nix b/modules/sunshine.nix
index 9384441..b705445 100644
--- a/modules/sunshine.nix
+++ b/modules/sunshine.nix
@@ -46,17 +46,53 @@ in
         PATH = "$(PATH):/run/current-system/sw/bin:/etc/profiles/per-user/${user}/bin:$(HOME)/.local/bin";
       };
 
-      apps = [
-        # the app that moondeck will call when connecting via moonlight
-        {
-          name = "MoonDeckStream";
-          cmd = "${auxiliaryPkgs.moondeck-buddy}/bin/MoonDeckStream";
-          image-path = "${auxiliaryPkgs.moondeck-buddy}/share/icons/hicolor/256x256/apps/moondeckbuddy.png";
-          exclude-global-prep-cmd = "false";
-          elevated = "false";
-        }
-        # + default applications, desktop, low-res desktop, steam big picture
-      ];
+      apps =
+        let
+          command =
+            name: cmd:
+            getExe (
+              pkgs.writeShellApplication {
+                inherit name;
+                runtimeInputs = with pkgs; [
+                  steam
+                  util-linux
+                ];
+                text = "sudo -u ${user} ${cmd}";
+              }
+            );
+        in
+        [
+          # moondeck will call this app when connecting via moonlight, automatically
+          {
+            name = "MoonDeckStream";
+            cmd = "${auxiliaryPkgs.moondeck-buddy}/bin/MoonDeckStream";
+            image-path = "${auxiliaryPkgs.moondeck-buddy}/share/icons/hicolor/256x256/apps/moondeckbuddy.png";
+            exclude-global-prep-cmd = "false";
+            elevated = "false";
+          }
+
+          # other applications, called manually
+          {
+            name = "Desktop";
+            image-path = "desktop.png";
+            # empty commands will always simply open desktop
+          }
+          {
+            name = "Steam";
+            image-path = "steam.png";
+            detached = [ (command "sunshine-open-steam-bp" "steam steam://open/bigpicture") ];
+            prep-cmd = [
+              {
+                do = "";
+                undo = command "sunshine-close-steam-bp" "steam steam://close/bigpicture"; # close up steam
+              }
+            ];
+            # sunshine can't track the steam startup properly, so don't.
+            auto-detach = "true";
+            wait-all = "true";
+            exit-timeout = "5";
+          }
+        ];
     };
   };