summaryrefslogtreecommitdiff
path: root/src/Propellor/Property/Laptop.hs
diff options
context:
space:
mode:
authorJoey Hess <joeyh@joeyh.name>2018-02-01 12:27:26 -0400
committerJoey Hess <joeyh@joeyh.name>2018-02-01 12:27:26 -0400
commite80ac83657169b973fd8fe25deb42f458da475b9 (patch)
tree885f8e981c9ff941ab959cdcc804a90c53c38509 /src/Propellor/Property/Laptop.hs
parent81d288629d82e1fa81bb004a74ef9480b3a544a0 (diff)
parent5cd0291025b92ee2e408abd73b2cb4225f22465d (diff)
Merge branch 'joeyconfig'
Diffstat (limited to 'src/Propellor/Property/Laptop.hs')
-rw-r--r--src/Propellor/Property/Laptop.hs28
1 files changed, 28 insertions, 0 deletions
diff --git a/src/Propellor/Property/Laptop.hs b/src/Propellor/Property/Laptop.hs
new file mode 100644
index 00000000..a36bda18
--- /dev/null
+++ b/src/Propellor/Property/Laptop.hs
@@ -0,0 +1,28 @@
+module Propellor.Property.Laptop where
+
+import Propellor.Base
+import qualified Propellor.Property.File as File
+import qualified Propellor.Property.Apt as Apt
+import qualified Propellor.Property.Systemd as Systemd
+
+-- | Makes powertop auto-tune the system for optimal power consumption on
+-- boot.
+powertopAutoTuneOnBoot :: RevertableProperty DebianLike DebianLike
+powertopAutoTuneOnBoot = setup <!> undo
+ `describe` "powertop auto-tune on boot"
+ where
+ setup = Systemd.enabled "powertop"
+ `requires` Apt.installed ["powertop"]
+ `requires` File.hasContent servicefile
+ [ "[Unit]"
+ , "Description=Powertop tunings"
+ , "[Service]"
+ , "ExecStart=/usr/sbin/powertop --auto-tune"
+ , "RemainAfterExit=true"
+ , "[Install]"
+ , "WantedBy=multi-user.target"
+ ]
+ undo = tightenTargets $ File.notPresent servicefile
+ `requires` check (doesFileExist servicefile)
+ (Systemd.disabled "powertop")
+ servicefile = "/etc/systemd/system/powertop.service"