source: dotfiles/guix/config-thinkpad.scm

Last change on this file was 254aa1d, checked in by Mikhail Kirillov <w96k@…>, on Aug 5, 2024 at 6:53:43 AM

Massively update guix home

  • Property mode set to 100644
File size: 8.5 KB
Line 
1;; -*- geiser-scheme-implementation: guile -*-
2
3(use-modules (gnu)
4 (gnu packages)
5 (srfi srfi-1))
6
7(use-service-modules
8 desktop
9 databases
10 networking
11 ssh
12 xorg
13 docker
14 virtualization
15 dbus
16 linux
17 pm
18 vpn
19 nix)
20
21(use-package-modules
22 wm
23 lisp
24 bash
25 linux
26 python
27 gnome
28 gawk
29 xorg
30 xdisorg)
31
32;; (define-public linux-libre-custom
33;; (package
34;; (inherit linux-libre)
35;; (native-inputs
36;; `(("kconfig" ,(local-file "fb.config"))
37;; ,@(alist-delete "kconfig"
38;; (package-native-inputs linux-libre))))))
39
40(define %cpupower-service
41 (simple-service
42 'cpupower activation-service-type
43 #~(zero? (system* #$(file-append cpupower "/bin/cpupower")
44 "frequency-set" "--governor" "schedutil"))))
45
46(define %x86-energy-perf-policy-service
47 (simple-service
48 'x86-energy-perf-policy-service activation-service-type
49 #~(zero? (system* #$(file-append x86-energy-perf-policy "/bin/x86_energy_perf_policy")
50 "--turbo-enable" "0"
51 "--hwp-desired" "16"))))
52
53(define %thinkfan-service
54 (simple-service
55 'thinkfan activation-service-type
56 #~(zero? (system* #$(file-append thinkfan "/sbin/thinkfan")))))
57
58
59(define i915-config
60 (plain-file "i915.conf"
61 "options i915 enable_fbc=1 enable_dc=0 modeset=1 enable_psr=0"))
62
63(define drm-kms-config
64 (plain-file "drm_kms.conf"
65 "options drm_kms_helper poll=N"))
66
67(define thinkpad-acpi-config
68 (plain-file "thinkpad_acpi.conf"
69 "options thinkpad_acpi fan_control=1"))
70
71;; tp_thermal /proc/acpi/ibm/thermal
72
73(define thinkfan-config
74 (plain-file "thinkfan.conf"
75 "\
76hwmon /sys/devices/platform/thinkpad_hwmon/hwmon/hwmon4/temp3_input
77hwmon /sys/devices/platform/thinkpad_hwmon/hwmon/hwmon4/temp5_input
78hwmon /sys/devices/platform/thinkpad_hwmon/hwmon/hwmon4/temp1_input
79hwmon /sys/devices/platform/thinkpad_hwmon/hwmon/hwmon4/temp4_input
80hwmon /sys/devices/platform/thinkpad_hwmon/hwmon/hwmon4/temp6_input
81hwmon /sys/devices/platform/thinkpad_hwmon/hwmon/hwmon4/temp7_input
82hwmon /sys/devices/platform/thinkpad_hwmon/hwmon/hwmon4/temp8_input
83hwmon /sys/devices/pci0000:00/0000:00:1f.2/ata1/host0/target0:0:0/0:0:0:0/hwmon/hwmon1/temp1_input
84hwmon /sys/devices/pci0000:00/0000:00:1f.2/ata2/host1/target1:0:0/1:0:0:0/hwmon/hwmon2/temp1_input
85# hwmon /sys/devices/platform/coretemp.0/hwmon/hwmon6/temp3_input
86# hwmon /sys/devices/platform/coretemp.0/hwmon/hwmon6/temp2_input
87hwmon /sys/devices/virtual/thermal/thermal_zone0/hwmon0/temp1_input
88hwmon /sys/devices/virtual/thermal/thermal_zone0/hwmon0/temp2_input
89tp_fan /proc/acpi/ibm/fan
90
91(0, 0, 35)
92(1, 30, 40)
93(2, 35, 50)
94(3, 45, 60)
95(4, 55, 65)
96(5, 60, 70)
97(6, 65, 75)
98(7, 70, 85)
99(\"level full-speed\", 78, 120)"))
100
101(define fancontrol-config
102 (plain-file "fancontrol"
103 "
104INTERVAL=10
105DEVPATH=hwmon0=devices/virtual/thermal/thermal_zone0 hwmon1=devices/platform/thinkpad_hwmon
106DEVNAME=hwmon0=acpitz hwmon5=thinkpad
107FCTEMPS=hwmon1/pwm1=hwmon0/temp1_input
108FCFANS= hwmon1/pwm1=hwmon5/fan1_input
109MINTEMP=hwmon1/pwm1=20
110MAXTEMP=hwmon1/pwm1=50
111MINSTART=hwmon1/pwm1=150
112MINSTOP=hwmon1/pwm1=50
113MINPWM=hwmon1/pwm1=10"))
114
115(operating-system
116 (locale "ru_RU.utf8")
117 (timezone "Europe/Tbilisi")
118 (keyboard-layout
119 (keyboard-layout
120 "us,ru"
121 #:options
122 '("grp:shifts_toggle"
123 "caps:ctrl_modifier")))
124 ;; (kernel linux-libre-5.19)
125 ;; (kernel-loadable-modules '(acpi-call-linux-module))
126 (kernel-arguments
127 '("consoleblank=0"
128 ;; "processor.max_cstate=3" ; Disable power savings
129 ;; "intel_idle.max_cstate=0" ; (cstate 3-4 provides
130 ;; ; high freq cpu noice)
131 "vblank_mode=0"
132 ;;"vm.swappiness=5"
133 "thinkpad_acpi.fan_control=1"
134 "acpi_sleep=s3_bios"
135 "acpi_osi=Linux"
136 "i915.modeset=1"
137 ;; "i915.enable_dc=0"
138 ;; "i915.enable_psr=0"
139 "rootfstype=ext4"
140 "KVM"
141 "loglevel=7"
142 ;;"logo"
143 "ahci.mobile_lpm_policy=1"
144 "intremap=off" ; Fix for failed to map dmar2
145 "modprobe.blacklist=pcspkr,usbmouse,usbkbd,glx"))
146 (host-name "w96k-x200t")
147 (users
148 (cons*
149 (user-account
150 (name "w96k")
151 (comment "Mikhail Kirillov")
152 (group "users")
153 (home-directory "/home/w96k")
154 (supplementary-groups
155 '("wheel" "netdev" "audio" "video" "kvm" "docker")))
156 %base-user-accounts))
157 (packages
158 (append
159 (map
160 specification->package
161 '("xterm"
162 "xinit"
163 "xorg-server"
164 "font-gnu-unifont"
165 "font-gnu-freefont"
166 "mesa"
167 "mesa-utils"
168 "ratpoison"
169 "wmname"
170 "windowmaker"
171 "nss-certs"
172 "docker-compose"
173 "thinkfan"
174 "cpupower"
175 "lm-sensors"
176 "x86-energy-perf-policy"
177 "git"
178 "stow"
179 "lm-sensors"
180 "xset"
181 "cpuid"
182 ;; Video Codecs stuff
183 "gstreamer"
184 "gst-plugins-base"
185 "gst-plugins-good"
186 "gst-plugins-bad"
187 "gst-plugins-ugly"
188 "gst-libav"
189 ;; "intel-vaapi-driver-g45-h264"
190 "libva-utils"
191 "igt-gpu-tools"
192 ;; Xorg
193 "xev"
194 "xset"
195 "xrdb"
196 "xhost"
197 "xmodmap"
198 "setxkbmap"
199 "xrandr"
200 "arandr"
201 "xss-lock"
202 "libinput"
203 "xinput"
204 "xf86-input-libinput"
205 ;; "xf86-video-fbdev"
206 "xf86-video-intel"
207 "qemu"))
208 %base-packages))
209
210 (services
211 (cons*
212 (service docker-service-type)
213 (service thermald-service-type)
214 (service virtlog-service-type)
215 (service libvirt-service-type
216 (libvirt-configuration (unix-sock-group "libvirt")))
217 (service openssh-service-type)
218 (service tor-service-type)
219
220 ;;Wacom tablet support
221 (service inputattach-service-type
222 (inputattach-configuration
223 (device "/dev/ttyS4")
224 (device-type "wacom")))
225
226 (service kernel-module-loader-service-type
227 '("thinkpad_acpi"
228 "msr"
229 "coretemp"
230 "acpi_cpufreq"
231 "overlay"))
232
233 (simple-service 'thinkpad-acpi-config etc-service-type
234 (list `("modprobe.d/thinkpad_acpi.conf"
235 ,thinkpad-acpi-config)))
236
237 ;; (simple-service 'fancontrol-config etc-service-type
238 ;; (list `("fancontrol"
239 ;; ,fancontrol-config)))
240
241 ;; (simple-service 'thinkfan-config etc-service-type
242 ;; (list `("thinkfan.conf"
243 ;; ,thinkfan-config)))
244
245 (simple-service 'i915-config etc-service-type
246 (list `("modprobe.d/i915.conf"
247 ,i915-config)))
248
249 (simple-service 'drm-kms-config etc-service-type
250 (list `("modprobe.d/drm_kms.conf"
251 ,drm-kms-config)))
252
253 ;; (service openvpn-client-service-type
254 ;; (openvpn-client-configuration
255 ;; (persist-tun? #t)
256 ;; (remote
257 ;; (list
258 ;; (openvpn-remote-configuration
259 ;; (name "nyc.vpn.riseup.net")
260 ;; (port 1196))))))
261
262 (service special-files-service-type
263 `(("/bin/bash" ,(file-append bash "/bin/bash"))
264 ("/bin/python" ,(file-append python "/bin/python3"))
265 ("/bin/python3" ,(file-append python "/bin/python3"))
266 ("/bin/awk" ,(file-append gawk "/usr/bin/awk"))
267 ("/usr/bin/awk" ,(file-append gawk "/usr/bin/awk"))
268 ("/lib64/ld-linux-x86-64.so.2"
269 ,(file-append (canonical-package glibc)
270 "/lib/ld-linux-x86-64.so.2"))))
271
272 (service nix-service-type
273 (nix-configuration
274 (extra-config '("trusted-users = root w96k"))))
275
276 (service postgresql-service-type)
277
278 %cpupower-service
279
280 ;; Doesn't start on boot sadly :(
281 %thinkfan-service
282
283 %x86-energy-perf-policy-service
284
285 (screen-locker-service xlockmore "xlock")
286
287
288 ;; (service xorg-server-service-type
289 ;; (xorg-configuration
290 ;; (keyboard-layout keyboard-layout)))
291
292 ;; (service hurd-vm-service-type
293 ;; (hurd-vm-configuration
294 ;; (disk-size (* 8 (expt 2 30))) ;12GiB
295 ;; (memory-size 1024)))
296
297 (service slim-service-type
298 (slim-configuration
299 (xorg-configuration
300 (xorg-configuration
301 (drivers '("modesetting"))
302 (keyboard-layout keyboard-layout)))))
303
304
305 (modify-services %desktop-services
306 (delete gdm-service-type))))
307
308 (bootloader
309 (bootloader-configuration
310 (bootloader grub-bootloader)
311 (target "/dev/sda")
312 (keyboard-layout keyboard-layout)))
313 (swap-devices
314 (list
315 (swap-space
316 (target "/dev/sda1"))))
317 (file-systems
318 (cons*
319 (file-system
320 (mount-point "/")
321 (device
322 (uuid "c184f446-df67-4103-b28e-465ac8776f10"
323 'ext4))
324 (type "ext4")
325 (options "discard"))
326
327 ;; Thinkpad doc HDD
328
329 ;;(file-system
330 ;;(mount-point "/media/hdd/")
331 ;;(device
332 ;; (uuid "71cb0818-baf3-4f7f-8bc2-7e2b0cca3488"
333 ;; 'ext4))
334 ;; (type "ext4"))
335
336 %base-file-systems)))
Note: See TracBrowser for help on using the repository browser.