2019-09-25 03:23:59 +01:00
|
|
|
{ config, lib, pkgs, ... }:
|
|
|
|
|
|
|
|
with lib;
|
|
|
|
|
|
|
|
let
|
2019-09-25 12:43:06 +01:00
|
|
|
cfg = config.hardware.fancontrol;
|
2019-09-25 03:23:59 +01:00
|
|
|
|
|
|
|
in {
|
|
|
|
|
2019-09-25 12:28:16 +01:00
|
|
|
options.hardware.fancontrol = {
|
2019-09-25 13:49:28 +01:00
|
|
|
enable = mkEnableOption "fancontrol (requires a configuration file, see pwmconfig)";
|
2019-09-25 03:23:59 +01:00
|
|
|
|
|
|
|
configFile = mkOption {
|
|
|
|
type = types.str;
|
|
|
|
default = "/etc/fancontrol";
|
|
|
|
example = "/home/user/.config/fancontrol";
|
|
|
|
description = "Path to the configuration file, likely generated with pwmconfig.";
|
|
|
|
};
|
|
|
|
};
|
|
|
|
|
|
|
|
config = mkIf cfg.enable {
|
|
|
|
systemd.services.fancontrol = {
|
|
|
|
description = "Fan speed control from lm_sensors";
|
|
|
|
wantedBy = [ "multi-user.target" ];
|
|
|
|
serviceConfig = {
|
|
|
|
Type = "simple";
|
|
|
|
ExecStart = "${pkgs.lm_sensors}/bin/fancontrol ${cfg.configFile}";
|
|
|
|
};
|
|
|
|
};
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
}
|