about summary refs log tree commit diff
path: root/nixos
diff options
context:
space:
mode:
authorDomen Kožar <domen@enlambda.com>2019-03-05 17:47:13 +0700
committerGitHub <noreply@github.com>2019-03-05 17:47:13 +0700
commitf60459a023a71f929a9c0c9f4a871c0f05befe5c (patch)
treee5de216287a6426a683ac7a72795473d36064382 /nixos
parent1f409d0879e410d659c83eb5b0256329a85e22c9 (diff)
parent1278615a4832a8cb691b43a942d0dbce3eb73b9e (diff)
downloadnixlib-f60459a023a71f929a9c0c9f4a871c0f05befe5c.tar
nixlib-f60459a023a71f929a9c0c9f4a871c0f05befe5c.tar.gz
nixlib-f60459a023a71f929a9c0c9f4a871c0f05befe5c.tar.bz2
nixlib-f60459a023a71f929a9c0c9f4a871c0f05befe5c.tar.lz
nixlib-f60459a023a71f929a9c0c9f4a871c0f05befe5c.tar.xz
nixlib-f60459a023a71f929a9c0c9f4a871c0f05befe5c.tar.zst
nixlib-f60459a023a71f929a9c0c9f4a871c0f05befe5c.zip
Merge pull request #55142 from FlorianFranzen/thinkfan_smart
thinkfan: add option for libatasmart support
Diffstat (limited to 'nixos')
-rw-r--r--nixos/modules/services/hardware/thinkfan.nix20
1 files changed, 15 insertions, 5 deletions
diff --git a/nixos/modules/services/hardware/thinkfan.nix b/nixos/modules/services/hardware/thinkfan.nix
index d17121ca1c5b..7c105e99ca54 100644
--- a/nixos/modules/services/hardware/thinkfan.nix
+++ b/nixos/modules/services/hardware/thinkfan.nix
@@ -47,6 +47,8 @@ let
     ${cfg.levels}
   '';
 
+  thinkfan = pkgs.thinkfan.override { smartSupport = cfg.smartSupport; };
+
 in {
 
   options = {
@@ -61,6 +63,15 @@ in {
         '';
       };
 
+      smartSupport = mkOption {
+        type = types.bool;
+        default = false;
+        description = ''
+          Whether to build thinkfan with SMART support to read temperatures 
+          directly from hard disks.
+        '';
+      };
+
       sensors = mkOption {
         type = types.lines;
         default = ''
@@ -77,7 +88,7 @@ in {
               Which may be provided by any hwmon drivers (keyword
               hwmon)
 
-            S.M.A.R.T. (since 0.9 and requires the USE_ATASMART compilation flag)
+            S.M.A.R.T. (requires smartSupport to be enabled)
               Which reads the temperature directly from the hard
               disk using libatasmart (keyword atasmart)
 
@@ -125,18 +136,17 @@ in {
 
   config = mkIf cfg.enable {
 
-    environment.systemPackages = [ pkgs.thinkfan ];
+    environment.systemPackages = [ thinkfan ];
 
     systemd.services.thinkfan = {
       description = "Thinkfan";
       after = [ "basic.target" ];
       wantedBy = [ "multi-user.target" ];
-      path = [ pkgs.thinkfan ];
-      serviceConfig.ExecStart = "${pkgs.thinkfan}/bin/thinkfan -n -c ${configFile}";
+      path = [ thinkfan ];
+      serviceConfig.ExecStart = "${thinkfan}/bin/thinkfan -n -c ${configFile}";
     };
 
     boot.extraModprobeConfig = "options thinkpad_acpi experimental=1 fan_control=1";
 
   };
-
 }