about summary refs log tree commit diff
path: root/nixos/modules/tasks/powertop.nix
diff options
context:
space:
mode:
authorJörg Thalheim <joerg@thalheim.io>2017-04-15 14:36:10 +0200
committerJörg Thalheim <joerg@thalheim.io>2017-04-15 15:17:02 +0200
commitb9d9083322add2026935898d5a372a3a2464e92e (patch)
treec7c331ab95fba8282c4ca7113f6ff2b15acf6750 /nixos/modules/tasks/powertop.nix
parent26f5fa8f974aba0c08376e995deb8c50aff48727 (diff)
downloadnixlib-b9d9083322add2026935898d5a372a3a2464e92e.tar
nixlib-b9d9083322add2026935898d5a372a3a2464e92e.tar.gz
nixlib-b9d9083322add2026935898d5a372a3a2464e92e.tar.bz2
nixlib-b9d9083322add2026935898d5a372a3a2464e92e.tar.lz
nixlib-b9d9083322add2026935898d5a372a3a2464e92e.tar.xz
nixlib-b9d9083322add2026935898d5a372a3a2464e92e.tar.zst
nixlib-b9d9083322add2026935898d5a372a3a2464e92e.zip
powertop: add module
Diffstat (limited to 'nixos/modules/tasks/powertop.nix')
-rw-r--r--nixos/modules/tasks/powertop.nix27
1 files changed, 27 insertions, 0 deletions
diff --git a/nixos/modules/tasks/powertop.nix b/nixos/modules/tasks/powertop.nix
new file mode 100644
index 000000000000..6f57f5f5c25e
--- /dev/null
+++ b/nixos/modules/tasks/powertop.nix
@@ -0,0 +1,27 @@
+{ config, lib, pkgs, ... }:
+
+with lib;
+
+let
+  cfg = config.powerManagment.powertop;
+in {
+  ###### interface
+
+  options.powerManagment.powertop.enable = mkEnableOption "powertop auto tuning on startup";
+
+  ###### implementation
+
+  config = mkIf (cfg.enable) {
+    systemd.services = {
+      powertop = {
+        wantedBy = [ "multi-user.target" ];
+        description = "Powertop tunings";
+        serviceConfig = {
+          Type = "oneshot";
+          RemainAfterExit = "yes";
+          ExecStart = "${pkgs.powertop}/bin/powertop --auto-tune";
+        };
+      };
+    };
+  };
+}