nixpkgs/nixos/modules/services/hardware/fancontrol.nix
2019-09-25 05:05:32 +02:00

40 lines
895 B
Nix

{ config, lib, pkgs, ... }:
with lib;
let
cfg = config.services.fancontrol;
in {
options.services.fancontrol = {
enable = mkOption {
type = types.bool;
default = false;
example = true;
description = "Whether to enable fancontrol (requires a configuration file, see pwmconfig)";
};
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";
User = "root";
ExecStart = "${pkgs.lm_sensors}/bin/fancontrol ${cfg.configFile}";
};
};
};
}