diff --git a/clanModules/sunshine.nix b/clanModules/sunshine.nix index 20a01083..7198cb0d 100644 --- a/clanModules/sunshine.nix +++ b/clanModules/sunshine.nix @@ -155,7 +155,7 @@ in startLimitBurst = 5; startLimitIntervalSec = 500; script = '' - ${lib.getExe pkgs.sunshine} --creds sunshine sunshine + ${lib.getExe pkgs.sunshine} ${sunshineConfiguration} --creds sunshine sunshine ''; serviceConfig = { Restart = "on-failure"; diff --git a/pkgs/flake-module.nix b/pkgs/flake-module.nix index d446ed95..f03cd1e9 100644 --- a/pkgs/flake-module.nix +++ b/pkgs/flake-module.nix @@ -19,6 +19,7 @@ tea-create-pr = pkgs.callPackage ./tea-create-pr { }; zerotier-members = pkgs.callPackage ./zerotier-members { }; zt-tcp-relay = pkgs.callPackage ./zt-tcp-relay { }; + moonlight-sunshine-accept = pkgs.callPackage ./moonlight-sunshine-accept { }; merge-after-ci = pkgs.callPackage ./merge-after-ci { inherit (config.packages) tea-create-pr; }; pending-reviews = pkgs.callPackage ./pending-reviews { }; } diff --git a/pkgs/moonlight-sunshine-accept/moonlight_sunshine_accept/moonlight/run.py b/pkgs/moonlight-sunshine-accept/moonlight_sunshine_accept/moonlight/run.py index 20a76117..2cf12df7 100644 --- a/pkgs/moonlight-sunshine-accept/moonlight_sunshine_accept/moonlight/run.py +++ b/pkgs/moonlight-sunshine-accept/moonlight_sunshine_accept/moonlight/run.py @@ -10,18 +10,19 @@ class MoonlightPairing: self.found = threading.Event() def init_pairing(self, host: str, pin: str) -> bool: + # host = f"[{host}]" args = ["moonlight", "pair", host, "--pin", pin] print("Trying to pair") try: - self.process = subprocess.Popen( - args, stderr=subprocess.PIPE, stdout=subprocess.PIPE - ) + print(f"Running command: {args}") + self.process = subprocess.Popen(args, stdout=subprocess.PIPE) print("Pairing initiated") thread = threading.Thread( target=self.stream_output, args=('Latest supported GFE server: "99.99.99.99"',), ) thread.start() + print("Thread started") return True except Exception as e: print( @@ -51,6 +52,8 @@ class MoonlightPairing: self.found.set() break - def wait_until_started(self) -> None: - self.found.wait() - print("Started up.") + def wait_until_started(self, timeout: int = 10) -> None: + if self.found.wait(timeout): + print("Started up.") + else: + print("Starting up took took too long. Terminated the process.")