summaryrefslogtreecommitdiffstats
path: root/nixos
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
parent26f5fa8f974aba0c08376e995deb8c50aff48727 (diff)
powertop: add module
Diffstat (limited to 'nixos')
-rw-r--r--nixos/modules/module-list.nix1
-rw-r--r--nixos/modules/tasks/powertop.nix27
2 files changed, 28 insertions, 0 deletions
diff --git a/nixos/modules/module-list.nix b/nixos/modules/module-list.nix
index f7608a57d714..0cd02d259e45 100644
--- a/nixos/modules/module-list.nix
+++ b/nixos/modules/module-list.nix
@@ -659,6 +659,7 @@
./tasks/scsi-link-power-management.nix
./tasks/swraid.nix
./tasks/trackpoint.nix
+ ./tasks/powertop.nix
./testing/service-runner.nix
./virtualisation/container-config.nix
./virtualisation/containers.nix
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";
+ };
+ };
+ };
+ };
+}