summaryrefslogtreecommitdiff
path: root/modules/thinkpad.nix
blob: df24573efe846ca5d6866fb669e2ef08e99f5c69 (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
35
36
37
38
39
40
41
42
43
{ config, lib, pkgs, ... }:
let
  cfg = config.orbekk.desktop;
in
{
  options = {
    orbekk.thinkpad = {
      enable = lib.mkEnableOption "Enable standard desktop config";
    };
  };

  config = {
    services = {
      tlp = {
        enable = true;
        settings = {
          "SATA_LINKPWR_ON_BAT" = "max_performance";
        };
      };
      xserver.xkbModel = "thinkpad60";
    };

    boot = {
      kernelModules = [ "tp_smapi" "thinkpad_acpi" "fbcon" "i915" "acpi_call" ];
      extraModulePackages = with config.boot.kernelPackages; [ tp_smapi acpi_call ];
    };

    systemd.services = {
      battery_threshold = {
        description = "Set battery charging thresholds.";
        path = [ pkgs.tpacpi-bat ];
        after = [ "basic.target" ];
        wantedBy = [ "multi-user.target" ];
        script = ''
        tpacpi-bat -s ST 1 39
        tpacpi-bat -s ST 2 39
        tpacpi-bat -s SP 1 80
        tpacpi-bat -s SP 2 80
      '';
      };
    };
  };
}