at 24.11-pre 1.9 kB view raw
1import ./make-test-python.nix ({ pkgs, lib, ... }: { 2 name = "sunshine"; 3 meta = { 4 # test is flaky on aarch64 5 broken = pkgs.stdenv.isAarch64; 6 maintainers = [ lib.maintainers.devusb ]; 7 }; 8 9 nodes.sunshine = { config, pkgs, ... }: { 10 imports = [ 11 ./common/x11.nix 12 ]; 13 14 services.sunshine = { 15 enable = true; 16 openFirewall = true; 17 settings = { 18 capture = "x11"; 19 encoder = "software"; 20 output_name = 0; 21 }; 22 }; 23 24 environment.systemPackages = with pkgs; [ 25 gxmessage 26 ]; 27 28 }; 29 30 nodes.moonlight = { config, pkgs, ... }: { 31 imports = [ 32 ./common/x11.nix 33 ]; 34 35 environment.systemPackages = with pkgs; [ 36 moonlight-qt 37 ]; 38 39 }; 40 41 enableOCR = true; 42 43 testScript = '' 44 # start the tests, wait for sunshine to be up 45 start_all() 46 sunshine.wait_for_open_port(48010,"localhost") 47 48 # set the admin username/password, restart sunshine 49 sunshine.execute("sunshine --creds sunshine sunshine") 50 sunshine.systemctl("restart sunshine","root") 51 sunshine.wait_for_open_port(48010,"localhost") 52 53 # initiate pairing from moonlight 54 moonlight.execute("moonlight pair sunshine --pin 1234 >&2 & disown") 55 moonlight.wait_for_console_text("Executing request") 56 57 # respond to pairing request from sunshine 58 sunshine.succeed("curl --insecure -u sunshine:sunshine -d '{\"pin\": \"1234\"}' https://localhost:47990/api/pin") 59 60 # close moonlight once pairing complete 61 moonlight.send_key("kp_enter") 62 63 # put words on the sunshine screen for moonlight to see 64 sunshine.execute("gxmessage 'hello world' -center -font 'sans 75' >&2 & disown") 65 66 # connect to sunshine from moonlight and look for the words 67 moonlight.execute("moonlight --video-decoder software stream sunshine 'Desktop' >&2 & disown") 68 moonlight.wait_for_text("hello world") 69 ''; 70})