diff options
| -rw-r--r-- | modules/sunshine.nix | 52 |
1 files changed, 37 insertions, 15 deletions
diff --git a/modules/sunshine.nix b/modules/sunshine.nix index 3d44889..9384441 100644 --- a/modules/sunshine.nix +++ b/modules/sunshine.nix @@ -1,10 +1,20 @@ -{ me, lib, auxiliaryPkgs, ... }: +{ + me, + lib, + pkgs, + auxiliaryPkgs, + ... +}: let + inherit (lib) + substring + toUpper + getExe + ; + # todo: move this to a utils package - capitalize = str: - with builtins; - lib.toUpper (substring 0 1 str) + substring 1 (-1) str; + capitalize = str: toUpper (substring 0 1 str) + substring 1 (-1) str; user = "mel"; in @@ -37,9 +47,11 @@ in }; 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"; } @@ -48,19 +60,29 @@ in }; }; - # configuration for moondeck-buddy for a nicer integration with the steam deck + # run the buddy app for the moondeck for a nicer integration of sunshine/moonlight + # when using a steam deck! + systemd.user.services.moondeck-buddy = { + description = "MoonDeck Buddy"; - home-manager.users.${user} = - { inputs, config, ... }: - { - # start moondeck-buddy automatically - xdg.autostart = { - enable = true; - entries = with auxiliaryPkgs; [ - "${moondeck-buddy}/share/applications/MoonDeckBuddy.desktop" - ]; - }; + wantedBy = [ "graphical-session.target" ]; + partOf = [ "graphical-session.target" ]; + after = [ + "graphical-session.target" + "network-online.target" + ]; + + serviceConfig = { + ExecStart = "${getExe auxiliaryPkgs.moondeck-buddy}"; + + # try to stay alive even if something moondeck-buddy depends on, + # like steam, crashes. + Restart = "on-failure"; + RestartSec = "5s"; + + Environment = "QT_QPA_PLATFORM=wayland"; }; + }; networking.firewall.allowedTCPPorts = [ 59999 ]; # port for moondeck-buddy } |
