blob: 00ccfbb6a01cfa856f23259b5c92f883db228961 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
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" ];
};
}
|