Starting work on fan control with opencode
This commit is contained in:
@@ -5,5 +5,6 @@
|
||||
# ./programs
|
||||
./services
|
||||
./filesystem
|
||||
./services/systemd
|
||||
];
|
||||
}
|
||||
|
||||
37
modules/nixos/services/systemd/fancontrol.nix
Normal file
37
modules/nixos/services/systemd/fancontrol.nix
Normal 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;
|
||||
};
|
||||
};
|
||||
}
|
||||
Reference in New Issue
Block a user