summaryrefslogtreecommitdiffstats
path: root/nixos/tests/xpadneo.nix
blob: a8d77bdf6f22f6329f35d60aff0e930a35333c41 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
{ lib, pkgs, ... }:
{
  name = "xpadneo";
  meta.maintainers = with lib.maintainers; [ kira-bruneau ];

  nodes = {
    machine = {
      config.hardware.xpadneo = {
        enable = true;
        rumbleAttenuation = {
          overall = 50;
          triggers = 25;
        };
        settings = {
          disable_deadzones = 1;
          trigger_rumble_mode = 2;
        };
      };
    };
  };

  # This is just a sanity check to make sure the module was
  # loaded. We'd have to find some way to mock an xbox controller if
  # we wanted more in-depth testing.
  testScript = ''
    machine.start();
    machine.succeed("modinfo hid_xpadneo | grep 'version:\s\+${pkgs.linuxPackages.xpadneo.version}'")

    machine.succeed("grep 'options hid_xpadneo' /etc/modprobe.d/nixos.conf")
    machine.succeed("grep 'disable_deadzones=1' /etc/modprobe.d/nixos.conf")
    machine.succeed("grep 'trigger_rumble_mode=2' /etc/modprobe.d/nixos.conf")
    machine.succeed("grep 'rumble_attenuation=50,25' /etc/modprobe.d/nixos.conf")
  '';
}