diff options
author | Luna Nova <git@lunnova.dev> | 2022-02-18 13:47:54 -0800 |
---|---|---|
committer | Luna Nova <git@lunnova.dev> | 2022-03-07 08:31:40 -0800 |
commit | 865e0df2fc3dd06ca7b5730a7f3651a94beb4006 (patch) | |
tree | 760d9f53e494e8121d28c711b67e771b249887ed | |
parent | d8cb49476539a9743da6dfc8eb1d2aa554fa59be (diff) | |
download | nixpkgs-865e0df2fc3dd06ca7b5730a7f3651a94beb4006.tar nixpkgs-865e0df2fc3dd06ca7b5730a7f3651a94beb4006.tar.gz nixpkgs-865e0df2fc3dd06ca7b5730a7f3651a94beb4006.tar.bz2 nixpkgs-865e0df2fc3dd06ca7b5730a7f3651a94beb4006.tar.lz nixpkgs-865e0df2fc3dd06ca7b5730a7f3651a94beb4006.tar.xz nixpkgs-865e0df2fc3dd06ca7b5730a7f3651a94beb4006.tar.zst nixpkgs-865e0df2fc3dd06ca7b5730a7f3651a94beb4006.zip |
nixos/input-remapper: add nixos test for input-remapper
-rw-r--r-- | nixos/modules/services/misc/input-remapper.nix | 2 | ||||
-rw-r--r-- | nixos/tests/all-tests.nix | 1 | ||||
-rw-r--r-- | nixos/tests/input-remapper.nix | 45 |
3 files changed, 47 insertions, 1 deletions
diff --git a/nixos/modules/services/misc/input-remapper.nix b/nixos/modules/services/misc/input-remapper.nix index 6440e490464..f5fb2bf5308 100644 --- a/nixos/modules/services/misc/input-remapper.nix +++ b/nixos/modules/services/misc/input-remapper.nix @@ -23,7 +23,7 @@ let cfg = config.services.input-remapper; in services.dbus.packages = [ cfg.package ]; systemd.packages = [ cfg.package ]; environment.systemPackages = [ cfg.package ]; - systemd.services.input-remapper.wantedBy = [ "graphical.target" ]; + systemd.services.input-remapper.wantedBy = cfg.serviceWantedBy; }; meta.maintainers = with lib.maintainers; [ LunNova ]; 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..8b993961708 --- /dev/null +++ b/nixos/tests/input-remapper.nix @@ -0,0 +1,45 @@ +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; + # passwordless pkexec bodge + 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") + ''; + }) |