-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathhw.nix
133 lines (119 loc) · 4.02 KB
/
hw.nix
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
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
{ config, lib, pkgs, ... }:
let cfg = config.cookie.hardware;
in with lib; {
options.cookie.hardware = {
t480s = {
enable = mkEnableOption "Enables Thinkpad T480s specific hardware quirks";
undervolt = mkEnableOption "Enables Thinkpad T480s CPU undervolting";
};
motherboard = mkOption {
type = types.nullOr (types.enum [ "amd" "intel" ]);
default = null;
description =
lib.mdDoc "CPU family of motherboard. Used for `cookie.openrgb`";
};
};
# We need to do this after the libinput Xorg config
config = mkMerge [
(mkIf cfg.t480s.enable {
services.xserver.config = (mkAfter ''
Section "InputClass"
Identifier "Set NatrualScrolling for TrackPoint"
Driver "libinput"
MatchIsPointer "on"
Option "NaturalScrolling" "off"
EndSection
Section "InputClass"
Identifier "Set Tapping for Touchpad"
Driver "libinput"
MatchIsTouchpad "on"
Option "Tapping" "off"
EndSection
'');
# services.logind.extraConfig = ''
# HandlePowerKey=ignore
# '';
})
(mkIf cfg.t480s.undervolt {
services.throttled = {
enable = true;
extraConfig = ''
[GENERAL]
# Enable or disable the script execution
Enabled: True
# SYSFS path for checking if the system is running on AC power
Sysfs_Power_Path: /sys/class/power_supply/AC*/online
# Auto reload config on changes
Autoreload: True
## Settings to apply while connected to Battery power
[BATTERY]
# Update the registers every this many seconds
Update_Rate_s: 30
# Max package power for time window #1
PL1_Tdp_W: 29
# Time window #1 duration
PL1_Duration_s: 28
# Max package power for time window #2
PL2_Tdp_W: 44
# Time window #2 duration
PL2_Duration_S: 0.002
# Max allowed temperature before throttling
Trip_Temp_C: 85
# Set cTDP to normal=0, down=1 or up=2 (EXPERIMENTAL)
cTDP: 1
# Disable BDPROCHOT (EXPERIMENTAL)
Disable_BDPROCHOT: False
## Settings to apply while connected to AC power
[AC]
# Update the registers every this many seconds
Update_Rate_s: 5
# Max package power for time window #1
PL1_Tdp_W: 44
# Time window #1 duration
PL1_Duration_s: 28
# Max package power for time window #2
PL2_Tdp_W: 44
# Time window #2 duration
PL2_Duration_S: 0.002
# Max allowed temperature before throttling
Trip_Temp_C: 95
# Set HWP energy performance hints to 'performance' on high load (EXPERIMENTAL)
# Uncomment only if you really want to use it
# HWP_Mode: False
# Set cTDP to normal=0, down=1 or up=2 (EXPERIMENTAL)
cTDP: 2
# Disable BDPROCHOT (EXPERIMENTAL)
Disable_BDPROCHOT: False
# All voltage values are expressed in mV and *MUST* be negative (i.e. undervolt)!
# XXX: Tuned for thonkcookie
[UNDERVOLT.BATTERY]
# CPU core/cache voltage offset (mV)
# On Skylake and newer CPUs CORE and CACHE values should match!
# XXX: crashes between 160-170
CORE: -125
CACHE: -125
# Integrated GPU voltage offset (mV)
GPU: -80
# System Agent voltage offset (mV)
UNCORE: -80
# Analog I/O voltage offset (mV)
ANALOGIO: 0
# [ICCMAX.AC]
# # CPU core max current (A)
# CORE:
# # Integrated GPU max current (A)
# GPU:
# # CPU cache max current (A)
# CACHE:
# [ICCMAX.BATTERY]
# # CPU core max current (A)
# CORE:
# # Integrated GPU max current (A)
# GPU:
# # CPU cache max current (A)
# CACHE:
'';
};
})
];
}