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