propellor

propellor config for hosts.
git clone git://git.ricketyspace.net/propellor.git
Log | Files | Refs | LICENSE

Laptop.hs (1089B)


      1 module Propellor.Property.Laptop where
      2 
      3 import Propellor.Base
      4 import qualified Propellor.Property.File as File
      5 import qualified Propellor.Property.Apt as Apt
      6 import qualified Propellor.Property.Systemd as Systemd
      7 
      8 -- | Makes powertop auto-tune the system for optimal power consumption on
      9 -- boot.
     10 powertopAutoTuneOnBoot :: RevertableProperty DebianLike DebianLike
     11 powertopAutoTuneOnBoot = setup <!> undo
     12 	`describe` "powertop auto-tune on boot"
     13   where
     14 	setup = Systemd.enabled "powertop"
     15 		`requires` Apt.installed ["powertop"]
     16 		`requires` File.hasContent servicefile
     17 			[ "[Unit]"
     18 			, "Description=Powertop tunings"
     19 			, "[Service]"
     20 			, "ExecStart=/usr/sbin/powertop --auto-tune"
     21 			, "RemainAfterExit=true"
     22 			, "[Install]"
     23 			, "WantedBy=multi-user.target"
     24 			]
     25 	undo = tightenTargets $ File.notPresent servicefile
     26 		`requires` check (doesFileExist servicefile)
     27 			(Systemd.disabled "powertop")
     28 	servicefile = "/etc/systemd/system/powertop.service"
     29 
     30 -- | Enables weekly TRIM for SSDs, using systemd's fstrim.timer,
     31 trimSSD :: Property Linux
     32 trimSSD = Systemd.enabled "fstrim.timer"