38 lines
902 B
Nix
38 lines
902 B
Nix
{ 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;
|
|
};
|
|
};
|
|
}
|