<commit_before>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, ... }: ''<commit_msg>nixos/input-remapper: document pkexec workaround in test<commit_after>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, ... }: ''
{'fraction_non_alphanumeric': 0.12335526315789473, 'fraction_numerical': 0.001644736842105263, 'mean_word_length': 1.8159722222222223, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '793251', 'n_tokens_mistral': 752, 'n_tokens_neox': 713, 'n_words': 170}