<commit_before>{ config, lib, pkgs, ... }:

with lib;

{
  ###### interface

  options = {

    hardware.trackpoint = {

      enable = mkOption {
        default = false;
        type = types.bool;
        description = ''
          Enable sensitivity and speed configuration for trackpoints.
        '';
      };
  
      sensitivity = mkOption {
        default = 128;
        example = 255;
        type = types.int;
        description = ''
          Configure the trackpoint sensitivity. By default, the kernel
          configures 128.
        '';
      };

      speed = mkOption {
        default = 97;
        example = 255;
        type = types.int;
        description = ''
          Configure the trackpoint sensitivity. By default, the kernel
          configures 97.
        '';
      };
      
    };

  };


  ###### implementation

  config = mkIf config.hardware.trackpoint.enable {

    jobs.trackpoint =
      { description = "Initialize trackpoint";

        startOn = "started udev";

        task = true;

        script = ''
          echo -n ${toString config.hardware.trackpoint.sensitivity} \
            > /sys/devices/platform/i8042/serio1/sensitivity
          echo -n ${toString config.hardware.trackpoint.speed} \
            > /sys/devices/platform/i8042/serio1/speed
        '';
      };
         
  };

}<commit_msg>Fix trackpoint configuration on some systems<commit_after>{ config, lib, pkgs, ... }:

with lib;

{
  ###### interface

  options = {

    hardware.trackpoint = {

      enable = mkOption {
        default = false;
        type = types.bool;
        description = ''
          Enable sensitivity and speed configuration for trackpoints.
        '';
      };
  
      sensitivity = mkOption {
        default = 128;
        example = 255;
        type = types.int;
        description = ''
          Configure the trackpoint sensitivity. By default, the kernel
          configures 128.
        '';
      };

      speed = mkOption {
        default = 97;
        example = 255;
        type = types.int;
        description = ''
          Configure the trackpoint sensitivity. By default, the kernel
          configures 97.
        '';
      };
      
    };

  };


  ###### implementation

  config = mkIf config.hardware.trackpoint.enable {

    jobs.trackpoint =
      { description = "Initialize trackpoint";

        startOn = "started udev";

        task = true;

        script = ''
          for directory in /sys/devices/platform/i8042/serio1 \
                           /sys/devices/platform/i8042/serio1/serio2 \
                           /sys/devices/platform/i8042/serio4/serio5; do
            if [ -e "$directory/speed" ]; then
              echo -n ${toString config.hardware.trackpoint.speed} \
                > "$directory/speed"
              echo -n ${toString config.hardware.trackpoint.sensitivity} \
                > "$directory/sensitivity"
              break
            fi
          done
        '';
      };
         
  };

}
{'fraction_non_alphanumeric': 0.10756972111553785, 'fraction_numerical': 0.019588313413014608, 'mean_word_length': 1.500414937759336, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 7, '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': '2117891', 'n_tokens_mistral': 868, 'n_tokens_neox': 804, 'n_words': 189}