From ade1f149b7eef87ff92d30f9ee5041dd5fcf40a3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Cyryl=20P=C5=82otnicki?= Date: Sat, 6 Jul 2019 12:03:30 +0100 Subject: [PATCH] Add thinkpad-specific throttling --- nixos/boxes/foureighty.nix | 36 ++++++++++++++++++++++++++++++++++++ 1 file changed, 36 insertions(+) diff --git a/nixos/boxes/foureighty.nix b/nixos/boxes/foureighty.nix index b0b2f948..d2175f6e 100644 --- a/nixos/boxes/foureighty.nix +++ b/nixos/boxes/foureighty.nix @@ -29,6 +29,42 @@ hardware.bumblebee.enable = true; hardware.bumblebee.connectDisplay = true; + hardware.trackpoint.enable = true; + + services.fprintd.enable = true; + + systemd.services.cpu-throttling = { + enable = true; + description = "CPU Throttling Fix"; + documentation = [ + "https://wiki.archlinux.org/index.php/Lenovo_ThinkPad_X1_Carbon_(Gen_6)#Power_management.2FThrottling_issues" + ]; + path = [ pkgs.msr-tools ]; + script = "wrmsr -a 0x1a2 0x3000000"; + serviceConfig = { + Type = "oneshot"; + }; + wantedBy = [ + "timers.target" + ]; + }; + + systemd.timers.cpu-throttling = { + enable = true; + description = "CPU Throttling Fix"; + documentation = [ + "https://wiki.archlinux.org/index.php/Lenovo_ThinkPad_X1_Carbon_(Gen_6)#Power_management.2FThrottling_issues" + ]; + timerConfig = { + OnActiveSec = 60; + OnUnitActiveSec = 60; + Unit = "cpu-throttling.service"; + }; + wantedBy = [ + "timers.target" + ]; + }; + imports = [ /etc/nixos/hardware-configuration.nix ../boot.nix