From aaf03d7f0022f77ba1c2656ff0aec88ae7b36597 Mon Sep 17 00:00:00 2001 From: Morgan Helton Date: Tue, 10 Dec 2024 19:40:40 -0600 Subject: [PATCH 1/3] sunshine: move to by-name --- .../0001-fix-upnp-support-newer-miniupnpc-library-2782.patch | 0 pkgs/{servers => by-name/su}/sunshine/package-lock.json | 0 .../sunshine/default.nix => by-name/su/sunshine/package.nix} | 0 pkgs/{servers => by-name/su}/sunshine/updater.sh | 0 pkgs/top-level/all-packages.nix | 2 +- 5 files changed, 1 insertion(+), 1 deletion(-) rename pkgs/{servers => by-name/su}/sunshine/0001-fix-upnp-support-newer-miniupnpc-library-2782.patch (100%) rename pkgs/{servers => by-name/su}/sunshine/package-lock.json (100%) rename pkgs/{servers/sunshine/default.nix => by-name/su/sunshine/package.nix} (100%) rename pkgs/{servers => by-name/su}/sunshine/updater.sh (100%) diff --git a/pkgs/servers/sunshine/0001-fix-upnp-support-newer-miniupnpc-library-2782.patch b/pkgs/by-name/su/sunshine/0001-fix-upnp-support-newer-miniupnpc-library-2782.patch similarity index 100% rename from pkgs/servers/sunshine/0001-fix-upnp-support-newer-miniupnpc-library-2782.patch rename to pkgs/by-name/su/sunshine/0001-fix-upnp-support-newer-miniupnpc-library-2782.patch diff --git a/pkgs/servers/sunshine/package-lock.json b/pkgs/by-name/su/sunshine/package-lock.json similarity index 100% rename from pkgs/servers/sunshine/package-lock.json rename to pkgs/by-name/su/sunshine/package-lock.json diff --git a/pkgs/servers/sunshine/default.nix b/pkgs/by-name/su/sunshine/package.nix similarity index 100% rename from pkgs/servers/sunshine/default.nix rename to pkgs/by-name/su/sunshine/package.nix diff --git a/pkgs/servers/sunshine/updater.sh b/pkgs/by-name/su/sunshine/updater.sh similarity index 100% rename from pkgs/servers/sunshine/updater.sh rename to pkgs/by-name/su/sunshine/updater.sh diff --git a/pkgs/top-level/all-packages.nix b/pkgs/top-level/all-packages.nix index bd4aedf998d0b..0f55b5c000cba 100644 --- a/pkgs/top-level/all-packages.nix +++ b/pkgs/top-level/all-packages.nix @@ -18792,7 +18792,7 @@ with pkgs; sieveshell = with python3.pkgs; toPythonApplication managesieve; - sunshine = callPackage ../servers/sunshine { }; + sunshine = callPackage ../by-name/su/sunshine/package.nix { }; jami = qt6Packages.callPackage ../applications/networking/instant-messengers/jami { # TODO: remove once `udev` is `systemdMinimal` everywhere. From f6262762b2bda19e1ea187d53af0e223d50619c3 Mon Sep 17 00:00:00 2001 From: Morgan Helton Date: Tue, 10 Dec 2024 19:56:58 -0600 Subject: [PATCH 2/3] sunshine: fix tray icon and menu links --- nixos/modules/services/networking/sunshine.nix | 2 ++ pkgs/top-level/all-packages.nix | 4 +++- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/nixos/modules/services/networking/sunshine.nix b/nixos/modules/services/networking/sunshine.nix index eaa769246add0..2b723b74ce7b2 100644 --- a/nixos/modules/services/networking/sunshine.nix +++ b/nixos/modules/services/networking/sunshine.nix @@ -177,6 +177,8 @@ in startLimitIntervalSec = 500; startLimitBurst = 5; + environment.PATH = lib.mkForce null; # don't use default PATH, needed for tray icon menu links to work + serviceConfig = { # only add configFile if an application or a setting other than the default port is set to allow configuration from web UI ExecStart = escapeSystemdExecArgs ( diff --git a/pkgs/top-level/all-packages.nix b/pkgs/top-level/all-packages.nix index 0f55b5c000cba..54d0b3ce5eb05 100644 --- a/pkgs/top-level/all-packages.nix +++ b/pkgs/top-level/all-packages.nix @@ -18792,7 +18792,9 @@ with pkgs; sieveshell = with python3.pkgs; toPythonApplication managesieve; - sunshine = callPackage ../by-name/su/sunshine/package.nix { }; + sunshine = callPackage ../by-name/su/sunshine/package.nix { + boost = boost185; + }; jami = qt6Packages.callPackage ../applications/networking/instant-messengers/jami { # TODO: remove once `udev` is `systemdMinimal` everywhere. From 46abca2b83640403d8e449080fbc16bb928f6815 Mon Sep 17 00:00:00 2001 From: ghpzin Date: Wed, 18 Sep 2024 16:43:48 +0300 Subject: [PATCH 3/3] nixos/tests/sunshine: fix test - change text in `wait_for_console_text` to prevent sending curl with pairing response before moonlight can accept it - remove "close moonlight" step as next window stays on top in fullscreen, previous window with pairing result does not interfere with test. Otherwise it needs OCR or some other way to only do `send_key("kp_enter")` after "Pairing complete" window is visible. - add different ways to increase chances of successfull OCR: hide icewm panel, gxmessage window takes full screen without titlebar or buttons, black background, white foreground, consolas font,"ABC" text - add `wait_for_console_text` to only run OCR after window is visible --- nixos/tests/sunshine.nix | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/nixos/tests/sunshine.nix b/nixos/tests/sunshine.nix index 96ba81d620683..14e2133538712 100644 --- a/nixos/tests/sunshine.nix +++ b/nixos/tests/sunshine.nix @@ -6,6 +6,7 @@ import ./make-test-python.nix ( # test is flaky on aarch64 broken = pkgs.stdenv.hostPlatform.isAarch64; maintainers = [ lib.maintainers.devusb ]; + timeout = 600; }; nodes.sunshine = @@ -58,20 +59,23 @@ import ./make-test-python.nix ( # initiate pairing from moonlight moonlight.execute("moonlight pair sunshine --pin 1234 >&2 & disown") - moonlight.wait_for_console_text("Executing request") + moonlight.wait_for_console_text("Executing request.*pair") # respond to pairing request from sunshine - sunshine.succeed("curl --insecure -u sunshine:sunshine -d '{\"pin\": \"1234\"}' https://localhost:47990/api/pin") + sunshine.succeed("curl --fail --insecure -u sunshine:sunshine -d '{\"pin\": \"1234\"}' https://localhost:47990/api/pin") - # close moonlight once pairing complete - moonlight.send_key("kp_enter") + # wait until pairing is complete + moonlight.wait_for_console_text("Executing request.*phrase=pairchallenge") + # hide icewm panel + sunshine.send_key("ctrl-alt-h") # put words on the sunshine screen for moonlight to see - sunshine.execute("gxmessage 'hello world' -center -font 'sans 75' >&2 & disown") + sunshine.execute("gxmessage ' ABC' -center -font 'consolas 100' -fg '#FFFFFF' -bg '#000000' -borderless -geometry '2000x2000' -buttons \"\" >&2 & disown") # connect to sunshine from moonlight and look for the words moonlight.execute("moonlight --video-decoder software stream sunshine 'Desktop' >&2 & disown") - moonlight.wait_for_text("hello world") + moonlight.wait_for_console_text("Dropping window event during flush") + moonlight.wait_for_text("ABC") ''; } )