From 4ba613b95fc2685211087c9436317edf28e898ba Mon Sep 17 00:00:00 2001 From: voidarc Date: Wed, 26 Aug 2026 18:43:18 +0100 Subject: [PATCH] added a thinkpad fan controller module (because that isnt inbuilt???) --- flake.lock | 8 +++--- modules/features/hyprland/default.nix | 3 ++- modules/hosts/mobile03/default.nix | 1 + modules/system/drivers/thinkpadFanControl.nix | 27 +++++++++++++++++++ 4 files changed, 34 insertions(+), 5 deletions(-) create mode 100644 modules/system/drivers/thinkpadFanControl.nix diff --git a/flake.lock b/flake.lock index 49921f6..3112015 100644 --- a/flake.lock +++ b/flake.lock @@ -374,11 +374,11 @@ "wshowkeys": "wshowkeys" }, "locked": { - "lastModified": 1787685448, - "narHash": "sha256-gvdmxEM49ZE6KqosyKIHsQ6V6NHcYrw9in2TpuFad4I=", + "lastModified": 1787750232, + "narHash": "sha256-Kx0A+ytaYCyuzdA4ROeFh5kHsgh3N510KdXHuMTRclA=", "ref": "refs/heads/main", - "rev": "0c27e34df40ba4865cb8d9838b80685fc3b79785", - "revCount": 69, + "rev": "a85e6b79b88045e91055e2564ffdaab2c8e23f11", + "revCount": 74, "type": "git", "url": "https://git.voidarc.co.uk/voidarc/hypr" }, diff --git a/modules/features/hyprland/default.nix b/modules/features/hyprland/default.nix index 0951dce..eb88550 100644 --- a/modules/features/hyprland/default.nix +++ b/modules/features/hyprland/default.nix @@ -45,6 +45,7 @@ environment.systemPackages = with pkgs; [ gsettings-desktop-schemas + glib ]; system.activationScripts.hyprRuntimeEnv = lib.stringAfter ["specialfs"] '' @@ -83,7 +84,7 @@ hyprland = inputs'.hyprland.packages.default.override { flags."--config" = "/run/hypr/config/hyprland.lua"; env."MODULES_ROOT" = "/run/hypr/config/modules"; - env."HYPRLAND_ROOT" = "/run/hypr/config"; + env."HYPRLAND_ROOT" = "/run/hypr/config"; runtimePackages = inputs.hyprland.lib.defaultRuntimePkgs.${system} // { diff --git a/modules/hosts/mobile03/default.nix b/modules/hosts/mobile03/default.nix index 09f4617..98e132d 100644 --- a/modules/hosts/mobile03/default.nix +++ b/modules/hosts/mobile03/default.nix @@ -9,6 +9,7 @@ mobile03Configuration intelDrivers development + thinkpadFanControl upower ({...}: { hyprland.enablePlugins = true; diff --git a/modules/system/drivers/thinkpadFanControl.nix b/modules/system/drivers/thinkpadFanControl.nix new file mode 100644 index 0000000..152e691 --- /dev/null +++ b/modules/system/drivers/thinkpadFanControl.nix @@ -0,0 +1,27 @@ +{ + self, + moduleWithSystem, + ... +}: { + flake.nixosModules.thinkpadFanControl = moduleWithSystem ({inputs', ...}: { + # Enable fan control for the thinkpad module (why is this not the default??) + boot.extraModprobeConfig = '' + options thinkpad_acpi fan_control=1 + ''; + + services.thinkfan = { + enable = true; + + extraArgs = ["-s" "5"]; + + levels = [ + [0 0 55] + [1 50 60] + [3 58 68] + [5 65 75] + [7 73 85] + ["level disengaged" 82 32767] + ]; + }; + }); +}