about summary refs log tree commit diff
path: root/modules/hardware/thinkpad.nix
blob: 189ccc98a0ced15cd80010a66414e34e6b5c2c2f (plain) (blame)
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
35
36
37
38
39
40
41
42
43
{ lib, config, pkgs, ... }:
let
  cfg = config.vuizvui.hardware.thinkpad;

in
{
  options.vuizvui.hardware.thinkpad = {
    enable = lib.mkEnableOption "thinkpad support";
  };

  config = lib.mkIf cfg.enable {

    # We need to update the Intel microcode on every update,
    # otherwise there can be problems with newers kernels.
    hardware.cpu.intel.updateMicrocode = lib.mkDefault true;

    # read acpi stats (e.g. battery)
    environment.systemPackages = [ pkgs.acpi ];

    # for wifi
    hardware.enableRedistributableFirmware = lib.mkDefault true;

    hardware.trackpoint = lib.mkDefault {
      enable = true;
      emulateWheel = true;
      speed = 250;
      sensitivity = 140;
    };

    # TLP Linux Advanced Power Management
    services.tlp.enable = lib.mkDefault true;
    boot = {
      # acpi_call is required for some tlp features, e.g. discharge/recalibrate
      kernelModules = [
        "acpi_call"
      ];

      extraModulePackages = [
        config.boot.kernelPackages.acpi_call
      ];
    };
  };
}