diff options
author | Timo Kaufmann <timokau@zoho.com> | 2022-03-07 18:51:08 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-03-07 18:51:08 +0100 |
commit | 94ea3a88999a92e9498584e728d5ac7b9e9f2882 (patch) | |
tree | 4fd6e0f735a6e2d66262eedf99b35a63daeeb81c /nixos/tests | |
parent | 75ea3ea9b8c0beecc5db8ef8c429d9354573d776 (diff) | |
parent | 064362042091a21a75a682d7d9d0811e0033f73b (diff) | |
download | nixpkgs-94ea3a88999a92e9498584e728d5ac7b9e9f2882.tar nixpkgs-94ea3a88999a92e9498584e728d5ac7b9e9f2882.tar.gz nixpkgs-94ea3a88999a92e9498584e728d5ac7b9e9f2882.tar.bz2 nixpkgs-94ea3a88999a92e9498584e728d5ac7b9e9f2882.tar.lz nixpkgs-94ea3a88999a92e9498584e728d5ac7b9e9f2882.tar.xz nixpkgs-94ea3a88999a92e9498584e728d5ac7b9e9f2882.tar.zst nixpkgs-94ea3a88999a92e9498584e728d5ac7b9e9f2882.zip |
Merge pull request #160777 from LunNova/improve-input-remapper-module
nixos/input-remapper: Fix missing [], add more options, add test
Diffstat (limited to 'nixos/tests')
-rw-r--r-- | nixos/tests/all-tests.nix | 1 | ||||
-rw-r--r-- | nixos/tests/input-remapper.nix | 52 |
2 files changed, 53 insertions, 0 deletions
diff --git a/nixos/tests/all-tests.nix b/nixos/tests/all-tests.nix index 342e8f461b5..15b54cd9fe1 100644 --- a/nixos/tests/all-tests.nix +++ b/nixos/tests/all-tests.nix @@ -224,6 +224,7 @@ in initrd-network-ssh = handleTest ./initrd-network-ssh {}; initrdNetwork = handleTest ./initrd-network.nix {}; initrd-secrets = handleTest ./initrd-secrets.nix {}; + input-remapper = handleTest ./input-remapper.nix {}; inspircd = handleTest ./inspircd.nix {}; installer = handleTest ./installer.nix {}; invoiceplane = handleTest ./invoiceplane.nix {}; diff --git a/nixos/tests/input-remapper.nix b/nixos/tests/input-remapper.nix new file mode 100644 index 00000000000..f692564caa5 --- /dev/null +++ b/nixos/tests/input-remapper.nix @@ -0,0 +1,52 @@ +import ./make-test-python.nix ({ pkgs, ... }: + + { + name = "input-remapper"; + meta = { + maintainers = with pkgs.lib.maintainers; [ LunNova ]; + }; + + machine = { config, ... }: + let user = config.users.users.sybil; in + { + imports = [ + ./common/user-account.nix + ./common/x11.nix + ]; + + services.xserver.enable = true; + services.input-remapper.enable = true; + users.users.sybil = { isNormalUser = true; group = "wheel"; }; + test-support.displayManager.auto.user = user.name; + # workaround for pkexec not working in the test environment + # Error creating textual authentication agent: + # Error opening current controlling terminal for the process (`/dev/tty'): + # No such device or address + # passwordless pkexec with polkit module also doesn't work + # to allow the program to run, we replace pkexec with sudo + # and turn on passwordless sudo + # this is not correct in general but good enough for this test + security.sudo = { enable = true; wheelNeedsPassword = false; }; + security.wrappers.pkexec = pkgs.lib.mkForce + { + setuid = true; + owner = "root"; + group = "root"; + source = "${pkgs.sudo}/bin/sudo"; + }; + }; + + enableOCR = true; + + testScript = { nodes, ... }: '' + start_all() + machine.wait_for_x() + + machine.succeed("systemctl status input-remapper.service") + machine.execute("su - sybil -c input-remapper-gtk >&2 &") + + machine.wait_for_text("Input Remapper") + machine.wait_for_text("Preset") + machine.wait_for_text("Change Key") + ''; + }) |