From de2045cdc81ddef7b01b3445fb731a3252f5b4a8 Mon Sep 17 00:00:00 2001 From: Christopher Allan Webber Date: Sat, 13 May 2017 19:37:02 -0500 Subject: [PATCH 2/2] services: Add 'thermald-service-type'. * gnu/services/admin.scm (): New record type. (thermald-shepherd-service, thermald-service-type): New variables. * doc/guix.texi (Thermal Management): New section documenting thermald. --- doc/guix.texi | 23 ++++++++++++++++++++++- gnu/services/admin.scm | 51 ++++++++++++++++++++++++++++++++++++++++++++++---- 2 files changed, 69 insertions(+), 5 deletions(-) diff --git a/doc/guix.texi b/doc/guix.texi index 22dc8b3f9..1fee7616c 100644 --- a/doc/guix.texi +++ b/doc/guix.texi @@ -35,7 +35,8 @@ Copyright @copyright{} 2017 Mathieu Othacehe@* Copyright @copyright{} 2017 Federico Beffa@* Copyright @copyright{} 2017 Carlo Zancanaro@* Copyright @copyright{} 2017 Thomas Danckaert@* -Copyright @copyright{} 2017 humanitiesNerd +Copyright @copyright{} 2017 humanitiesNerd@* +Copyright @copyright{} 2017 Christopher Allan Webber Permission is granted to copy, distribute and/or modify this document under the terms of the GNU Free Documentation License, Version 1.3 or @@ -14746,6 +14747,26 @@ The following is an example @code{dicod-service} configuration. %dicod-database:gcide)))) @end example +@subsection Thermal Management + +The @code{(gnu services admin)} module provides an interface to +thermald, a cpu frequency scaling service which helps prevent overheating. + +@defvr {Scheme Variable} thermald-service-type +This is the service type for thermald. +@end defvr + +@deftp {Data Type} thermald-configuration +Data type representing the configuration of THERMALD-SERVICE. + +@table @asis +@item @code{ignore-cpuid-check?} {default: @code{#f}} +Ignore cpuid check for supported CPU models. + +@end table +@end deftp + + @subsubsection Version Control The @code{(gnu services version-control)} module provides the following services: diff --git a/gnu/services/admin.scm b/gnu/services/admin.scm index 6ac24e32b..ec274b416 100644 --- a/gnu/services/admin.scm +++ b/gnu/services/admin.scm @@ -32,17 +32,27 @@ rottlog-configuration rottlog-configuration? rottlog-service - rottlog-service-type)) + rottlog-service-type + + thermald-configuration + thermald-service-type)) ;;; Commentary: ;;; -;;; This module implements configuration of rottlog by writing +;;; Various administration services. +;;; +;;; Code: + + + +;;; +;;; Rotlog +;;; +;;; This service implements configuration of rottlog by writing ;;; /etc/rottlog/{rc,hourly|daily|weekly}. Example usage ;;; ;;; (mcron-service) ;;; (service rottlog-service-type (rottlog-configuration)) -;;; -;;; Code: (define %rotated-files ;; Syslog files subject to rotation. @@ -118,4 +128,37 @@ (compose list rottlog-rottlog)))) (default-value (rottlog-configuration)))) + + +;;; +;;; thermald +;;; +;;; This service implements cpu scaling. Helps prevent overheating! + +(define-record-type* + thermald-configuration make-thermald-configuration + thermald-configuration? + (ignore-cpuid-check? thermald-ignore-cpuid-check? + (default #f))) + +(define (thermald-shepherd-service config) + (list + (shepherd-service + (provision '(thermald)) + (documentation "Run thermald cpu frequency scaling.") + (start #~(make-forkexec-constructor + '(#$(file-append thermald "/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)))) + ;;; admin.scm ends here -- 2.12.2