Starting work on fan control with opencode

This commit is contained in:
2025-08-08 18:18:21 -04:00
parent 911f3589a2
commit 857f0daa95
3 changed files with 64 additions and 0 deletions

View File

@@ -0,0 +1,37 @@
{ config, lib, pkgs, ... }:
with lib;
let
cfg = config.services.systemd-fancon;
in
{
options.services.systemd-fancon = {
enable = mkEnableOption "systemd-fancon service for fan control";
config = mkOption {
type = types.lines;
default = "";
description = "Configuration for systemd-fancon.";
};
};
config = mkIf cfg.enable {
environment.systemPackages = with pkgs; [
systemd-fancon
lm_sensors
];
boot.kernelModules = [ "amdgpu" ];
systemd.services.systemd-fancon = {
description = "systemd-fancon service";
wantedBy = [ "multi-user.target" ];
after = [ "network-online.target" ];
serviceConfig = {
ExecStart = "${pkgs.systemd-fancon}/bin/systemd-fancon -c ${cfg.configFile}";
Restart = "on-failure";
};
configFile = pkgs.writeText "systemd-fancon.conf" cfg.config;
};
};
}