about summary refs log tree commit diff
path: root/nixos
diff options
context:
space:
mode:
authorEvils <evils.devils@protonmail.com>2019-09-25 04:23:59 +0200
committerEvils <evils.devils@protonmail.com>2019-09-25 05:05:32 +0200
commit81b6dec3c8c576227463d7a45fced3e8c49ef1f2 (patch)
tree17f43c317ab3a406402a518a08ba91dc1eb5272b /nixos
parent5426932f7c664a8765d6904af20ef21310e95d4f (diff)
downloadnixlib-81b6dec3c8c576227463d7a45fced3e8c49ef1f2.tar
nixlib-81b6dec3c8c576227463d7a45fced3e8c49ef1f2.tar.gz
nixlib-81b6dec3c8c576227463d7a45fced3e8c49ef1f2.tar.bz2
nixlib-81b6dec3c8c576227463d7a45fced3e8c49ef1f2.tar.lz
nixlib-81b6dec3c8c576227463d7a45fced3e8c49ef1f2.tar.xz
nixlib-81b6dec3c8c576227463d7a45fced3e8c49ef1f2.tar.zst
nixlib-81b6dec3c8c576227463d7a45fced3e8c49ef1f2.zip
fancontrol service init
Diffstat (limited to 'nixos')
-rw-r--r--nixos/modules/module-list.nix1
-rw-r--r--nixos/modules/services/hardware/fancontrol.nix39
2 files changed, 40 insertions, 0 deletions
diff --git a/nixos/modules/module-list.nix b/nixos/modules/module-list.nix
index 775cc05aa0a9..a648eef46e55 100644
--- a/nixos/modules/module-list.nix
+++ b/nixos/modules/module-list.nix
@@ -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
diff --git a/nixos/modules/services/hardware/fancontrol.nix b/nixos/modules/services/hardware/fancontrol.nix
new file mode 100644
index 000000000000..bd4938ab5096
--- /dev/null
+++ b/nixos/modules/services/hardware/fancontrol.nix
@@ -0,0 +1,39 @@
+{ config, lib, pkgs, ... }:
+
+with lib;
+
+let
+  cfg = config.services.fancontrol;
+
+in {
+
+  options.services.fancontrol = {
+    enable = mkOption {
+      type = types.bool;
+      default = false;
+      example = true;
+      description = "Whether to enable fancontrol (requires a configuration file, see pwmconfig)";
+    };
+
+    configFile = mkOption {
+      type = types.str;
+      default = "/etc/fancontrol";
+      example = "/home/user/.config/fancontrol";
+      description = "Path to the configuration file, likely generated with pwmconfig.";
+    };
+  };
+
+  config = mkIf cfg.enable {
+    systemd.services.fancontrol = {
+      description = "Fan speed control from lm_sensors";
+      wantedBy = [ "multi-user.target" ];
+      serviceConfig = {
+        Type = "simple";
+        User = "root";
+        ExecStart = "${pkgs.lm_sensors}/bin/fancontrol ${cfg.configFile}";
+      };
+    };
+  };
+
+
+}