summaryrefslogtreecommitdiff
path: root/modules/thinkpad.nix
diff options
context:
space:
mode:
Diffstat (limited to 'modules/thinkpad.nix')
-rw-r--r--modules/thinkpad.nix32
1 files changed, 32 insertions, 0 deletions
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" ];
+ };
+}