ctucx.git: nixfiles

ctucx' nixfiles

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 
44 
45 
46 
47 
48 
49 
50 
51 
52 
53 
54 
{ config, pkgs, lib, ... }:

let
  cfg = config.ctucxConfig.configure.mobileDevice;

in {

  options = {
    ctucxConfig.configure.mobileDevice = lib.mkEnableOption "mobile device";
  };

  config = lib.mkIf cfg {
    powerManagement = {
      enable          = true;
      cpuFreqGovernor = lib.mkDefault "powersave";
    };

    services = {
      upower.enable      = true;
  #    throttled.enable   = true;

      logind.lidSwitch   = "lock";
      logind.extraConfig = "HandlePowerKey=suspend";

      tlp = {
        enable = true;
        settings = {
          CPU_SCALING_GOVERNOR_ON_AC   = "performance";
          CPU_SCALING_GOVERNOR_ON_BAT  = "powersave";

          START_CHARGE_THRESH_BAT0     = 95;
          STOP_CHARGE_THRESH_BAT0      = 100;


          CPU_SCALING_MIN_FREQ_ON_AC   = 800000;
          CPU_SCALING_MAX_FREQ_ON_AC   = 3000000;
          CPU_SCALING_MIN_FREQ_ON_BAT  = 800000;
          CPU_SCALING_MAX_FREQ_ON_BAT  = 2000000;

          SOUND_POWER_SAVE_ON_AC       = 0;
          SOUND_POWER_SAVE_ON_BAT      = 1;

          RUNTIME_PM_ON_AC             = "on";
          RUNTIME_PM_ON_BAT            = "auto";

          NATACPI_ENABLE               = 1;
          TPACPI_ENABLE                = 1;
          TPSMAPI_ENABLE               = 1;
        };
      };
    };
  };

}