summary refs log tree commit diff
path: root/nixos/modules/services/hardware/undervolt.nix
diff options
context:
space:
mode:
authorJörg Thalheim <Mic92@users.noreply.github.com>2020-08-24 13:42:11 +0100
committerGitHub <noreply@github.com>2020-08-24 13:42:11 +0100
commit4c9ad3ca793e2418a725f2c227108b71db109913 (patch)
tree3dfb818a33da2cf65515970586a1723cb8792cb3 /nixos/modules/services/hardware/undervolt.nix
parent5c70c5eeaa275aae90e1d3e5b63a6fdcf29bc850 (diff)
parente207de63f4f4a8f377eed1f522dc872f338eb26c (diff)
downloadnixpkgs-4c9ad3ca793e2418a725f2c227108b71db109913.tar
nixpkgs-4c9ad3ca793e2418a725f2c227108b71db109913.tar.gz
nixpkgs-4c9ad3ca793e2418a725f2c227108b71db109913.tar.bz2
nixpkgs-4c9ad3ca793e2418a725f2c227108b71db109913.tar.lz
nixpkgs-4c9ad3ca793e2418a725f2c227108b71db109913.tar.xz
nixpkgs-4c9ad3ca793e2418a725f2c227108b71db109913.tar.zst
nixpkgs-4c9ad3ca793e2418a725f2c227108b71db109913.zip
Merge branch 'master' into nginx-update
Diffstat (limited to 'nixos/modules/services/hardware/undervolt.nix')
-rw-r--r--nixos/modules/services/hardware/undervolt.nix18
1 files changed, 17 insertions, 1 deletions
diff --git a/nixos/modules/services/hardware/undervolt.nix b/nixos/modules/services/hardware/undervolt.nix
index 828032dc573..054ffa35050 100644
--- a/nixos/modules/services/hardware/undervolt.nix
+++ b/nixos/modules/services/hardware/undervolt.nix
@@ -103,6 +103,17 @@ in
         The temperature target on battery power in Celsius degrees.
       '';
     };
+
+    useTimer = mkOption {
+      type = types.bool;
+      default = false;
+      description = ''
+        Whether to set a timer that applies the undervolt settings every 30s.
+        This will cause spam in the journal but might be required for some
+        hardware under specific conditions.
+        Enable this if your undervolt settings don't hold.
+      '';
+    };
   };
 
   config = mkIf cfg.enable {
@@ -114,6 +125,11 @@ in
       path = [ pkgs.undervolt ];
 
       description = "Intel Undervolting Service";
+
+      # Apply undervolt on boot, nixos generation switch and resume
+      wantedBy = [ "multi-user.target" "post-resume.target" ];
+      after = [ "post-resume.target" ]; # Not sure why but it won't work without this
+
       serviceConfig = {
         Type = "oneshot";
         Restart = "no";
@@ -121,7 +137,7 @@ in
       };
     };
 
-    systemd.timers.undervolt = {
+    systemd.timers.undervolt = mkIf cfg.useTimer {
       description = "Undervolt timer to ensure voltage settings are always applied";
       partOf = [ "undervolt.service" ];
       wantedBy = [ "multi-user.target" ];