1
0
Fork 1
mirror of https://github.com/NixOS/nixpkgs.git synced 2024-09-11 15:08:33 +01:00

Merge pull request #69398 from Evils-Devils/fancontrol

nixos/fancontrol: init
This commit is contained in:
markuskowa 2019-09-25 18:34:16 +02:00 committed by GitHub
commit 389c287b90
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 47 additions and 0 deletions

View file

@ -328,6 +328,7 @@
./services/hardware/bluetooth.nix
./services/hardware/bolt.nix
./services/hardware/brltty.nix
./services/hardware/fancontrol.nix
./services/hardware/freefall.nix
./services/hardware/fwupd.nix
./services/hardware/illum.nix

View file

@ -0,0 +1,46 @@
{ config, lib, pkgs, ... }:
with lib;
let
cfg = config.hardware.fancontrol;
configFile = pkgs.writeText "fan.conf" cfg.config;
in {
options.hardware.fancontrol = {
enable = mkEnableOption "fancontrol (requires fancontrol.config)";
config = mkOption {
type = types.lines;
default = null;
example = ''
# Configuration file generated by pwmconfig
INTERVAL=1
DEVPATH=hwmon0=devices/platform/nct6775.656 hwmon1=devices/pci0000:00/0000:00:18.3
DEVNAME=hwmon0=nct6779 hwmon1=k10temp
FCTEMPS=hwmon0/pwm2=hwmon1/temp1_input
FCFANS=hwmon0/pwm2=hwmon0/fan2_input
MINTEMP=hwmon0/pwm2=25
MAXTEMP=hwmon0/pwm2=60
MINSTART=hwmon0/pwm2=25
MINSTOP=hwmon0/pwm2=10
MINPWM=hwmon0/pwm2=0
MAXPWM=hwmon0/pwm2=255
'';
description = "Contents for configuration file. See <citerefentry><refentrytitle>pwmconfig</refentrytitle><manvolnum>8</manvolnum></citerefentry>.";
};
};
config = mkIf cfg.enable {
systemd.services.fancontrol = {
description = "Fan speed control from lm_sensors";
wantedBy = [ "multi-user.target" ];
serviceConfig = {
Type = "simple";
ExecStart = "${pkgs.lm_sensors}/bin/fancontrol ${configFile}";
};
};
};
}