diff options
| author | Christopher Allan Webber <cwebber@dustycloud.org> | 2017-05-13 19:37:02 -0500 |
|---|---|---|
| committer | Christopher Allan Webber <cwebber@dustycloud.org> | 2017-05-14 18:56:32 -0500 |
| commit | d7fa39ccec34bc223d52a04dfc3e1f756e2dfa24 (patch) | |
| tree | c103ddbca934dd4e9098e3786c6eee7e39c2d8b6 /gnu | |
| parent | 589896843854cbdb24f627a53e5a9af628c6e7fb (diff) | |
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')
| -rw-r--r-- | gnu/services/pm.scm | 41 |
1 files changed, 40 insertions, 1 deletions
diff --git a/gnu/services/pm.scm b/gnu/services/pm.scm index 3cefe1874a6..d40cb993e2b 100644 --- a/gnu/services/pm.scm +++ b/gnu/services/pm.scm | |||
| @@ -20,6 +20,7 @@ | |||
| 20 | #:use-module (guix gexp) | 20 | #:use-module (guix gexp) |
| 21 | #:use-module (guix packages) | 21 | #:use-module (guix packages) |
| 22 | #:use-module (guix records) | 22 | #:use-module (guix records) |
| 23 | #:use-module (gnu packages admin) | ||
| 23 | #:use-module (gnu packages linux) | 24 | #:use-module (gnu packages linux) |
| 24 | #:use-module (gnu services) | 25 | #:use-module (gnu services) |
| 25 | #:use-module (gnu services base) | 26 | #:use-module (gnu services base) |
| @@ -27,7 +28,10 @@ | |||
| 27 | #:use-module (gnu services shepherd) | 28 | #:use-module (gnu services shepherd) |
| 28 | #:use-module (gnu system shadow) | 29 | #:use-module (gnu system shadow) |
| 29 | #:export (tlp-service-type | 30 | #:export (tlp-service-type |
| 30 | tlp-configuration)) | 31 | tlp-configuration |
| 32 | |||
| 33 | thermald-configuration | ||
| 34 | thermald-service-type)) | ||
| 31 | 35 | ||
| 32 | (define (uglify-field-name field-name) | 36 | (define (uglify-field-name field-name) |
| 33 | (let ((str (symbol->string field-name))) | 37 | (let ((str (symbol->string field-name))) |
| @@ -403,3 +407,38 @@ shutdown on system startup.")) | |||
| 403 | (generate-documentation | 407 | (generate-documentation |
| 404 | `((tlp-configuration ,tlp-configuration-fields)) | 408 | `((tlp-configuration ,tlp-configuration-fields)) |
| 405 | 'tlp-configuration)) | 409 | 'tlp-configuration)) |
| 410 | |||
| 411 | |||
| 412 | |||
| 413 | ;;; | ||
| 414 | ;;; thermald | ||
| 415 | ;;; | ||
| 416 | ;;; This service implements cpu scaling. Helps prevent overheating! | ||
| 417 | |||
| 418 | (define-record-type* <thermald-configuration> | ||
| 419 | thermald-configuration make-thermald-configuration | ||
| 420 | thermald-configuration? | ||
| 421 | (ignore-cpuid-check? thermald-ignore-cpuid-check? ;boolean | ||
| 422 | (default #f)) | ||
| 423 | (thermald thermald-thermald ;package | ||
| 424 | (default thermald))) | ||
| 425 | |||
| 426 | (define (thermald-shepherd-service config) | ||
| 427 | (list | ||
| 428 | (shepherd-service | ||
| 429 | (provision '(thermald)) | ||
| 430 | (documentation "Run thermald cpu frequency scaling.") | ||
| 431 | (start #~(make-forkexec-constructor | ||
| 432 | '(#$(file-append (thermald-thermald config) "/sbin/thermald") | ||
| 433 | "--no-daemon" | ||
| 434 | #$@(if (thermald-ignore-cpuid-check? config) | ||
| 435 | '("--ignore-cpuid-check") | ||
| 436 | '())))) | ||
| 437 | (stop #~(make-kill-destructor))))) | ||
| 438 | |||
| 439 | (define thermald-service-type | ||
| 440 | (service-type | ||
| 441 | (name 'thermald) | ||
| 442 | (extensions (list (service-extension shepherd-root-service-type | ||
| 443 | thermald-shepherd-service))) | ||
| 444 | (default-value (thermald-configuration)))) | ||
