git.iko.soy/typeable/nixpkgs
on master help sign in
nixos/fancontrol: clean up module

set a group and user for the service remove default null config it's required, now it throws an error pointing to the option set myself (module author) as maintainer

commit5ae90276c38faec9c1e18b5e7b71af9eebd1b2af authorEvils <evils.devils@protonmail.com> dateFri 7 May 2021, 20:02 (6 years ago) parent3d043c6
1 file changed+21−7
nixos/modules/services/hardware/fancontrol.nix+21−7
nixos/modules/services/hardware/fancontrol.nix+21−7
@@ -6,21 +6,21 @@ let
66 cfg = config.hardware.fancontrol;
77 configFile = pkgs.writeText "fancontrol.conf" cfg.config;
88
9−in{
9+in
10+{
1011 options.hardware.fancontrol = {
1112 enable = mkEnableOption "software fan control (requires fancontrol.config)";
1213
1314 config = mkOption {
14− default = null;
15− type = types.nullOr types.lines;
16− description = "Fancontrol configuration file content. See <citerefentry><refentrytitle>pwmconfig</refentrytitle><manvolnum>8</manvolnum></citerefentry> from the lm_sensors package.";
15+ type = types.lines;
16+ description = "Required fancontrol configuration file content. See <citerefentry><refentrytitle>pwmconfig</refentrytitle><manvolnum>8</manvolnum></citerefentry> from the lm_sensors package.";
1717 example = ''
1818 # Configuration file generated by pwmconfig
1919 INTERVAL=10
2020 DEVPATH=hwmon3=devices/virtual/thermal/thermal_zone2 hwmon4=devices/platform/f71882fg.656
2121 DEVNAME=hwmon3=soc_dts1 hwmon4=f71869a
2222 FCTEMPS=hwmon4/device/pwm1=hwmon3/temp1_input
23− FCFANS= hwmon4/device/pwm1=hwmon4/device/fan1_input
23+ FCFANS=hwmon4/device/pwm1=hwmon4/device/fan1_input
2424 MINTEMP=hwmon4/device/pwm1=35
2525 MAXTEMP=hwmon4/device/pwm1=65
2626 MINSTART=hwmon4/device/pwm1=150
@@ -30,16 +30,30 @@ in{
3030 };
3131
3232 config = mkIf cfg.enable {
33+
34+ users = {
35+ groups.lm_sensors = {};
36+
37+ users.fancontrol = {
38+ isSystemUser = true;
39+ group = "lm_sensors";
40+ description = "fan speed controller";
41+ };
42+ };
43+
3344 systemd.services.fancontrol = {
34− unitConfig.Documentation = "man:fancontrol(8)";
45+ documentation = [ "man:fancontrol(8)" ];
3546 description = "software fan control";
3647 wantedBy = [ "multi-user.target" ];
3748 after = [ "lm_sensors.service" ];
3849
3950 serviceConfig = {
40− Type = "simple";
4151 ExecStart = "${pkgs.lm_sensors}/sbin/fancontrol ${configFile}";
52+ Group = "lm_sensors";
53+ User = "fancontrol";
4254 };
4355 };
4456 };
57+
58+ meta.maintainers = [ maintainers.evils ];
4559}