aboutsummaryrefslogtreecommitdiff
path: root/gnu/services
diff options
context:
space:
mode:
authorChristopher Allan Webber <cwebber@dustycloud.org>2017-05-13 19:37:02 -0500
committerChristopher Allan Webber <cwebber@dustycloud.org>2017-05-14 18:56:32 -0500
commitd7fa39ccec34bc223d52a04dfc3e1f756e2dfa24 (patch)
treec103ddbca934dd4e9098e3786c6eee7e39c2d8b6 /gnu/services
parent589896843854cbdb24f627a53e5a9af628c6e7fb (diff)
downloadguix-d7fa39ccec34bc223d52a04dfc3e1f756e2dfa24.tar
guix-d7fa39ccec34bc223d52a04dfc3e1f756e2dfa24.tar.gz
services: Add 'thermald-service-type'.
* gnu/services/pm.scm (<thermald-configuration>): New record type. (thermald-shepherd-service, thermald-service-type): New variables. * doc/guix.texi (Thermal Management): New section documenting thermald.
Diffstat (limited to 'gnu/services')
-rw-r--r--gnu/services/pm.scm41
1 files changed, 40 insertions, 1 deletions
diff --git a/gnu/services/pm.scm b/gnu/services/pm.scm
index 3cefe1874a..d40cb993e2 100644
--- a/gnu/services/pm.scm
+++ b/gnu/services/pm.scm
@@ -20,6 +20,7 @@
#:use-module (guix gexp)
#:use-module (guix packages)
#:use-module (guix records)
+ #:use-module (gnu packages admin)
#:use-module (gnu packages linux)
#:use-module (gnu services)
#:use-module (gnu services base)
@@ -27,7 +28,10 @@
#:use-module (gnu services shepherd)
#:use-module (gnu system shadow)
#:export (tlp-service-type
- tlp-configuration))
+ tlp-configuration
+
+ thermald-configuration
+ thermald-service-type))
(define (uglify-field-name field-name)
(let ((str (symbol->string field-name)))
@@ -403,3 +407,38 @@ shutdown on system startup."))
(generate-documentation
`((tlp-configuration ,tlp-configuration-fields))
'tlp-configuration))
+
+
+
+;;;
+;;; thermald
+;;;
+;;; This service implements cpu scaling. Helps prevent overheating!
+
+(define-record-type* <thermald-configuration>
+ thermald-configuration make-thermald-configuration
+ thermald-configuration?
+ (ignore-cpuid-check? thermald-ignore-cpuid-check? ;boolean
+ (default #f))
+ (thermald thermald-thermald ;package
+ (default thermald)))
+
+(define (thermald-shepherd-service config)
+ (list
+ (shepherd-service
+ (provision '(thermald))
+ (documentation "Run thermald cpu frequency scaling.")
+ (start #~(make-forkexec-constructor
+ '(#$(file-append (thermald-thermald config) "/sbin/thermald")
+ "--no-daemon"
+ #$@(if (thermald-ignore-cpuid-check? config)
+ '("--ignore-cpuid-check")
+ '()))))
+ (stop #~(make-kill-destructor)))))
+
+(define thermald-service-type
+ (service-type
+ (name 'thermald)
+ (extensions (list (service-extension shepherd-root-service-type
+ thermald-shepherd-service)))
+ (default-value (thermald-configuration))))