summaryrefslogtreecommitdiffstats
path: root/modules/hardware/laptop.nix
blob: af8d5814211aecdd8d1fe6627bf5f5a8d0dd02a2 (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
{
    config,
    lib,
    pkgs,
    ...
}: let
    laptopConfig = config.modules.hardware.laptop;
in {
    options.modules.hardware.laptop = {
        enable = lib.mkOption {
            type = lib.types.bool;
            default = false;
        };
    };

    config = lib.mkIf (laptopConfig.enable) {
        services.thermald.enable = true;
        services.tlp = {
            enable = true;
            settings = {
                CPU_SCALING_GOVERNOR_ON_AC = "performance";
                CPU_SCALING_GOVERNOR_ON_BAT = "powersave";

                CPU_ENERGY_PERF_POLICY_ON_AC = "performance";
                CPU_ENERGY_PERF_POLICY_ON_BAT = "power";

                CPU_MIN_PERF_ON_AC = 0;
                CPU_MAX_PERF_ON_AC = 100;

                CPU_MIN_PERF_ON_BAT = 0;
                CPU_MAX_PERF_ON_BAT = 33;

                START_CHARGE_THRESH_BAT0 = 75;
                STOP_CHARGE_THRESH_BAT0 = 95;
            };
        };

        environment.systemPackages = with pkgs; [ xorg.xbacklight ];
    };
}