From 07850aa993446bdea263679d91db7acc8b886db6 Mon Sep 17 00:00:00 2001 From: h7x4 Date: Thu, 2 Oct 2025 23:23:25 +0900 Subject: [PATCH] nixos/tests/ringboard: init --- nixos/tests/all-tests.nix | 1 + nixos/tests/ringboard.nix | 49 +++++++++++++++++++++++++++ pkgs/by-name/ri/ringboard/package.nix | 3 ++ 3 files changed, 53 insertions(+) create mode 100644 nixos/tests/ringboard.nix diff --git a/nixos/tests/all-tests.nix b/nixos/tests/all-tests.nix index 0216ea9d9bd5..98cb57a02c3a 100644 --- a/nixos/tests/all-tests.nix +++ b/nixos/tests/all-tests.nix @@ -1300,6 +1300,7 @@ in restic = runTest ./restic.nix; restic-rest-server = runTest ./restic-rest-server.nix; retroarch = runTest ./retroarch.nix; + ringboard = runTest ./ringboard.nix; rke2 = handleTestOn [ "aarch64-linux" "x86_64-linux" ] ./rke2 { }; rkvm = handleTest ./rkvm { }; rmfakecloud = runTest ./rmfakecloud.nix; diff --git a/nixos/tests/ringboard.nix b/nixos/tests/ringboard.nix new file mode 100644 index 000000000000..a0bd26c25c51 --- /dev/null +++ b/nixos/tests/ringboard.nix @@ -0,0 +1,49 @@ +{ + config, + pkgs, + lib, + ... +}: +{ + name = "ringboard"; + meta = { inherit (pkgs.ringboard.meta) maintainers; }; + + nodes.machine = { + imports = [ + ./common/user-account.nix + ./common/x11.nix + ]; + + test-support.displayManager.auto.user = "alice"; + + services.xserver.displayManager.sessionCommands = '' + '${lib.getExe pkgs.gedit}' & + ''; + + services.ringboard.x11.enable = true; + }; + + testScript = + { nodes, ... }: + let + inherit (nodes.machine.test-support.displayManager.auto) user; + in + '' + @polling_condition + def gedit_running(): + machine.succeed("pgrep gedit") + + with subtest("Wait for service startup"): + machine.wait_for_unit("graphical.target") + machine.wait_for_unit("ringboard-server.service", "${user}") + machine.wait_for_unit("ringboard-listener.service", "${user}") + + with subtest("Ensure clipboard is monitored"): + with gedit_running: # type: ignore[union-attr] + machine.send_chars("Hello world!") + machine.send_key("ctrl-a") + machine.send_key("ctrl-c") + machine.wait_for_console_text("Small selection transfer complete") + machine.succeed("su - '${user}' -c 'ringboard search Hello | grep world!'") + ''; +} diff --git a/pkgs/by-name/ri/ringboard/package.nix b/pkgs/by-name/ri/ringboard/package.nix index 4b240726bd8b..af04fa4b014f 100644 --- a/pkgs/by-name/ri/ringboard/package.nix +++ b/pkgs/by-name/ri/ringboard/package.nix @@ -9,6 +9,7 @@ xorg, makeWrapper, displayServer ? "x11", + nixosTests, }: assert lib.assertOneOf "displayServer" displayServer [ @@ -96,6 +97,8 @@ rustPlatform.buildRustPackage (finalAttrs: { sed -i "s|Icon=ringboard|Icon=$out/share/icons/hicolor/1024x1024/ringboard.jpeg|g" $out/share/applications/ringboard-egui.desktop ''; + passthru.tests.nixos = nixosTests.ringboard; + meta = { description = "Fast, efficient, and composable clipboard manager for Linux"; homepage = "https://github.com/SUPERCILEX/clipboard-history";