diff --git a/modules/default/remote.nix b/modules/default/remote.nix index f7e9be4..efd2ab2 100644 --- a/modules/default/remote.nix +++ b/modules/default/remote.nix @@ -1,4 +1,6 @@ { imports = [ + ../../packages/moondeck-buddy/appimage.nix + ../../packages/sunshine/default.nix ]; } diff --git a/packages/moondeck-buddy/appimage.nix b/packages/moondeck-buddy/appimage.nix index 5f0e077..8c6e034 100644 --- a/packages/moondeck-buddy/appimage.nix +++ b/packages/moondeck-buddy/appimage.nix @@ -17,7 +17,8 @@ extraPkgs = pkgs: with pkgs; [ - # Your extraPkgs here + steam + libappindicator-gtk3 ]; desktopItems = [ @@ -51,7 +52,36 @@ in { 59999 # Allow Moondeck Buddy to listen on this port ]; # If Moondeck Buddy also needs UDP, uncomment and add it here: - # networking.firewall.allowedUDPPorts = [ - # 59999 - # ]; + networking.firewall.allowedUDPPorts = [ + 59999 + ]; + + systemd.services.moondeck-buddy = { + description = "Moondeck Buddy service for Sunshine/Moonlight integration"; + after = ["network-online.target" "display-manager.service"]; # Ensure display manager is up + wantedBy = ["multi-user.target"]; # Still autostart with multi-user target + + serviceConfig = { + Type = "simple"; + User = "kenji"; # <--- IMPORTANT: User *must* have access to the display + Group = "users"; + + ExecStart = "${moondeckBuddyWrapped}/bin/moondeck-buddy"; + + Restart = "on-failure"; + RestartSec = 5; + + # Crucial for GUI applications running as system services: + Environment = [ + "DISPLAY=:0" # Assuming your main display is :0. This can vary. + # "XAUTHORITY=/home/your-username/.Xauthority" # Needed if using Xauthority + # If using Wayland, you might need XDG_RUNTIME_DIR and WAYLAND_DISPLAY + # "XDG_RUNTIME_DIR=/run/user/$(id -u your-username)" + # "WAYLAND_DISPLAY=wayland-0" # Or specific to your compositor + ]; + + # You might also need to explicitly grant access, e.g., with xhost + + # but that's a security hole. Best is to rely on user authentication. + }; + }; }