From b9d9083322add2026935898d5a372a3a2464e92e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=B6rg=20Thalheim?= Date: Sat, 15 Apr 2017 14:36:10 +0200 Subject: [PATCH] powertop: add module --- nixos/modules/module-list.nix | 1 + nixos/modules/tasks/powertop.nix | 27 +++++++++++++++++++++++++++ 2 files changed, 28 insertions(+) create mode 100644 nixos/modules/tasks/powertop.nix diff --git a/nixos/modules/module-list.nix b/nixos/modules/module-list.nix index f7608a57d71467..0cd02d259e4544 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 00000000000000..6f57f5f5c25e92 --- /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"; + }; + }; + }; + }; +}