at 23.05-pre 1.4 kB view raw
1import ./make-test-python.nix ({ pkgs, ...} : { 2 name = "emacs-daemon"; 3 meta = with pkgs.lib.maintainers; { 4 maintainers = [ ]; 5 }; 6 7 enableOCR = true; 8 9 nodes.machine = 10 { ... }: 11 12 { imports = [ ./common/x11.nix ]; 13 services.emacs = { 14 enable = true; 15 defaultEditor = true; 16 }; 17 18 # Important to get the systemd service running for root 19 environment.variables.XDG_RUNTIME_DIR = "/run/user/0"; 20 21 environment.variables.TEST_SYSTEM_VARIABLE = "system variable"; 22 }; 23 24 testScript = '' 25 machine.wait_for_unit("multi-user.target") 26 27 # checks that the EDITOR environment variable is set 28 machine.succeed('test $(basename "$EDITOR") = emacseditor') 29 30 # waits for the emacs service to be ready 31 machine.wait_until_succeeds( 32 "systemctl --user status emacs.service | grep 'Active: active'" 33 ) 34 35 # connects to the daemon 36 machine.succeed("emacsclient --no-wait --frame-parameters='((display . \"'\"$DISPLAY\"'\"))' --create-frame $EDITOR >&2") 37 38 # checks that Emacs shows the edited filename 39 machine.wait_for_text("emacseditor") 40 41 # makes sure environment variables are accessible from Emacs 42 machine.succeed( 43 "emacsclient --eval '(getenv \"TEST_SYSTEM_VARIABLE\")' | grep -q 'system variable'" 44 ) 45 46 machine.screenshot("emacsclient") 47 ''; 48})