at 25.11-pre 2.4 kB view raw
1import ./make-test-python.nix ( 2 { pkgs, lib, ... }: 3 { 4 name = "sunshine"; 5 meta = { 6 # test is flaky on aarch64 7 broken = pkgs.stdenv.hostPlatform.isAarch64; 8 maintainers = [ lib.maintainers.devusb ]; 9 timeout = 600; 10 }; 11 12 nodes.sunshine = 13 { config, pkgs, ... }: 14 { 15 imports = [ 16 ./common/x11.nix 17 ]; 18 19 services.sunshine = { 20 enable = true; 21 openFirewall = true; 22 settings = { 23 capture = "x11"; 24 encoder = "software"; 25 output_name = 0; 26 }; 27 }; 28 29 environment.systemPackages = with pkgs; [ 30 gxmessage 31 ]; 32 33 }; 34 35 nodes.moonlight = 36 { config, pkgs, ... }: 37 { 38 imports = [ 39 ./common/x11.nix 40 ]; 41 42 environment.systemPackages = with pkgs; [ 43 moonlight-qt 44 ]; 45 46 }; 47 48 enableOCR = true; 49 50 testScript = '' 51 # start the tests, wait for sunshine to be up 52 start_all() 53 sunshine.wait_for_open_port(48010,"localhost") 54 55 # set the admin username/password, restart sunshine 56 sunshine.execute("sunshine --creds sunshine sunshine") 57 sunshine.systemctl("restart sunshine","root") 58 sunshine.wait_for_open_port(48010,"localhost") 59 60 # initiate pairing from moonlight 61 moonlight.execute("moonlight pair sunshine --pin 1234 >&2 & disown") 62 moonlight.wait_for_console_text("Executing request.*pair") 63 64 # respond to pairing request from sunshine 65 sunshine.succeed("curl --fail --insecure -u sunshine:sunshine -d '{\"pin\":\"1234\",\"name\":\"1234\"}' https://localhost:47990/api/pin") 66 67 # wait until pairing is complete 68 moonlight.wait_for_console_text("Executing request.*phrase=pairchallenge") 69 70 # hide icewm panel 71 sunshine.send_key("ctrl-alt-h") 72 # put words on the sunshine screen for moonlight to see 73 sunshine.execute("gxmessage ' ABC' -center -font 'consolas 100' -fg '#FFFFFF' -bg '#000000' -borderless -geometry '2000x2000' -buttons \"\" >&2 & disown") 74 75 # connect to sunshine from moonlight and look for the words 76 moonlight.execute("moonlight --video-decoder software stream sunshine 'Desktop' >&2 & disown") 77 moonlight.wait_for_console_text("Dropping window event during flush") 78 moonlight.wait_for_text("ABC") 79 ''; 80 } 81)