From eba5869d86df1ab70b067fa8d31725905c22ae33 Mon Sep 17 00:00:00 2001 From: Ari Sosnovsky Date: Wed, 31 Jul 2024 14:38:01 -0400 Subject: [PATCH] Added fancontrol --- modules/hl-hardware/default.nix | 1 + modules/hl-hardware/fancontrol.nix | 30 ++++++++++++++++++++++++++++++ 2 files changed, 31 insertions(+) create mode 100644 modules/hl-hardware/fancontrol.nix 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"; + }; + }; + }; +}