diff --git a/modules/hl-hardware/default.nix b/modules/hl-hardware/default.nix index e93bb55..8e7ce89 100644 --- a/modules/hl-hardware/default.nix +++ b/modules/hl-hardware/default.nix @@ -2,5 +2,6 @@ { imports = [ ./fan2go.nix + ./fancontrol.nix ]; } diff --git a/modules/hl-hardware/fancontrol.nix b/modules/hl-hardware/fancontrol.nix new file mode 100644 index 0000000..81dfc3e --- /dev/null +++ b/modules/hl-hardware/fancontrol.nix @@ -0,0 +1,30 @@ +{ lib +, config +, pkgs +, ... +}: +let + cfg = config.homelab.hardware.fancontrol; +in +{ + options.homelab.hardware.fancontrol = with lib; { + enable = mkEnableOption "fancontrol"; + }; + + config = lib.mkIf cfg.enable { + systemd.services.fancontrol = { + enable = true; + description = "Fan control"; + wantedBy = [ "multi-user.target" "graphical.target" "rescue.target" ]; + + unitConfig = { + Type = "simple"; + }; + + serviceConfig = { + ExecStart = "${pkgs.lm_sensors}/bin/fancontrol"; + Restart = "always"; + }; + }; + }; +}