1 { config, lib, pkgs, ... }:
4 cfg = config.services.hddfancontrol;
11 services.hddfancontrol.enable = lib.mkEnableOption "hddfancontrol daemon";
13 services.hddfancontrol.disks = lib.mkOption {
14 type = with types; listOf path;
17 Drive(s) to get temperature from
19 example = ["/dev/sda"];
22 services.hddfancontrol.pwmPaths = lib.mkOption {
23 type = with types; listOf path;
26 PWM filepath(s) to control fan speed (under /sys)
28 example = ["/sys/class/hwmon/hwmon2/pwm1"];
31 services.hddfancontrol.smartctl = lib.mkOption {
35 Probe temperature using smartctl instead of hddtemp or hdparm
39 services.hddfancontrol.extraArgs = lib.mkOption {
40 type = with types; listOf str;
43 Extra commandline arguments for hddfancontrol
45 example = ["--pwm-start-value=32"
47 "--spin-down-time=900"];
51 config = lib.mkIf cfg.enable (
52 let args = lib.concatLists [
55 (lib.optional cfg.smartctl "--smartctl")
58 systemd.packages = [pkgs.hddfancontrol];
60 systemd.services.hddfancontrol = {
61 wantedBy = [ "multi-user.target" ];
62 environment.HDDFANCONTROL_ARGS = lib.escapeShellArgs args;
65 PrivateNetwork = true;