1{ pkgs, ... }:
2
3{
4 name = "input-remapper";
5 meta = {
6 maintainers = with pkgs.lib.maintainers; [ LunNova ];
7 };
8
9 nodes.machine =
10 { config, ... }:
11 let
12 user = config.users.users.sybil;
13 in
14 {
15 imports = [
16 ./common/user-account.nix
17 ./common/x11.nix
18 ];
19
20 services.xserver.enable = true;
21 services.input-remapper.enable = true;
22 users.users.sybil = {
23 isNormalUser = true;
24 group = "wheel";
25 };
26 test-support.displayManager.auto.user = user.name;
27 # workaround for pkexec not working in the test environment
28 # Error creating textual authentication agent:
29 # Error opening current controlling terminal for the process (`/dev/tty'):
30 # No such device or address
31 # passwordless pkexec with polkit module also doesn't work
32 # to allow the program to run, we replace pkexec with sudo
33 # and turn on passwordless sudo
34 # this is not correct in general but good enough for this test
35 security.sudo = {
36 enable = true;
37 wheelNeedsPassword = false;
38 };
39 security.wrappers.pkexec = pkgs.lib.mkForce {
40 setuid = true;
41 owner = "root";
42 group = "root";
43 source = "${pkgs.sudo}/bin/sudo";
44 };
45 };
46
47 enableOCR = true;
48
49 testScript =
50 { nodes, ... }:
51 ''
52 start_all()
53 machine.wait_for_x()
54
55 machine.succeed("systemctl status input-remapper.service")
56 machine.execute("su - sybil -c input-remapper-gtk >&2 &")
57
58 machine.wait_for_text("Input Remapper")
59 machine.wait_for_text("Device")
60 machine.wait_for_text("Presets")
61 machine.wait_for_text("Editor")
62 '';
63}