From a02ab9b9364f9212c0d5d2c27b49793f6f3bc0bb Mon Sep 17 00:00:00 2001 From: Simon Parri Date: Tue, 17 Jun 2025 02:18:39 -0500 Subject: modules/zcfan -> modules/thinkpad --- modules/thinkpad.nix | 32 ++++++++++++++++++++++++++++++++ 1 file changed, 32 insertions(+) create mode 100644 modules/thinkpad.nix (limited to 'modules/thinkpad.nix') diff --git a/modules/thinkpad.nix b/modules/thinkpad.nix new file mode 100644 index 0000000..00ccfbb --- /dev/null +++ b/modules/thinkpad.nix @@ -0,0 +1,32 @@ +{ lib, config, pkgs, ... }: + +let cfg = config.this.laptop.thinkpad; + mkZcfanConf = c: lib.generators.toKeyValue { + mkKeyValue = lib.generators.mkKeyValueDefault {} " "; + } c; + zcfanConf = mkZcfanConf cfg.zcfan.settings; +in +{ + options = { + this.laptop.thinkpad = { + enable = lib.mkEnableOption "thinkpad settings"; + zcfan = { + settings = lib.mkOption { + type = with lib.types; + attrsOf (oneOf [int str]); + default = { }; + description = "Settings for zcfan."; + }; + }; + }; + }; + + config = lib.mkIf cfg.enable { + boot.extraModprobeConfig = "options thinkpad_acpi fan_control=1"; + + environment.etc."zcfan.conf" = lib.mkIf (zcfanConf != "") { text = zcfanConf; }; + environment.systemPackages = [ pkgs.zcfan ]; + systemd.packages = [ pkgs.zcfan ]; + systemd.services.zcfan.wantedBy = [ "multi-user.target" ]; + }; +} -- cgit v1.2.3