summary refs log tree commit diff
diff options
context:
space:
mode:
authorLassulus <github@lassul.us>2020-08-22 11:48:30 +0200
committerGitHub <noreply@github.com>2020-08-22 11:48:30 +0200
commit82b424453b6dfba785952eb4f61cb54ff7340774 (patch)
tree068e1a0e9b942b79c8b82e86bc252c2c45f0ced6
parent5a6da75b7d00232f09d6b8742299e45de7ab1a46 (diff)
parentf5856db1b83671bae5dc9886f23c3612498a1246 (diff)
downloadnixpkgs-82b424453b6dfba785952eb4f61cb54ff7340774.tar
nixpkgs-82b424453b6dfba785952eb4f61cb54ff7340774.tar.gz
nixpkgs-82b424453b6dfba785952eb4f61cb54ff7340774.tar.bz2
nixpkgs-82b424453b6dfba785952eb4f61cb54ff7340774.tar.lz
nixpkgs-82b424453b6dfba785952eb4f61cb54ff7340774.tar.xz
nixpkgs-82b424453b6dfba785952eb4f61cb54ff7340774.tar.zst
nixpkgs-82b424453b6dfba785952eb4f61cb54ff7340774.zip
Merge pull request #86632 from Atemu/undervolt-timer-optional
Undervolt: Make timer optional
-rw-r--r--nixos/doc/manual/release-notes/rl-2009.xml7
-rw-r--r--nixos/modules/services/hardware/undervolt.nix18
2 files changed, 24 insertions, 1 deletions
diff --git a/nixos/doc/manual/release-notes/rl-2009.xml b/nixos/doc/manual/release-notes/rl-2009.xml
index f13be77f2c7..83bc2f82bbf 100644
--- a/nixos/doc/manual/release-notes/rl-2009.xml
+++ b/nixos/doc/manual/release-notes/rl-2009.xml
@@ -964,6 +964,13 @@ services.transmission.settings.rpc-bind-address = "0.0.0.0";
       The packages <package>perl</package>, <package>rsync</package> and <package>strace</package> were removed from <option>systemPackages</option>. If you need them, install them again with <code><xref linkend="opt-environment.systemPackages"/> = with pkgs; [ perl rsync strace ];</code> in your <filename>configuration.nix</filename>.
     </para>
    </listitem>
+   <listitem>
+    <para>
+      The <literal>undervolt</literal> option no longer needs to apply its
+      settings every 30s. If they still become undone, open an issue and restore
+      the previous behaviour using <literal>undervolt.useTimer</literal>.
+    </para>
+   </listitem>
   </itemizedlist>
  </section>
 </section>
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" ];