;;;
;;; This file is part of GNU Guix.
;;;
-;;; GNU Guix is free software: you can redistribute it and/or modify
+;;; GNU Guix is free software; you can redistribute it and/or modify
;;; it under the terms of the GNU General Public License as published by
;;; the Free Software Foundation, either version 3 of the License, or
;;; (at your option) any later version.
#: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)
#: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)))
(with-imported-modules '((guix build utils))
#~(begin
(use-modules (guix build utils))
- (copy-file #$config-file "/etc/tlp")))))
+ (copy-file #$config-file "/etc/tlp.conf")))))
(define tlp-service-type
(service-type
(compose list tlp-configuration-tlp))
(service-extension activation-service-type
tlp-activation)))
- (default-value (tlp-configuration))))
+ (default-value (tlp-configuration))
+ (description "Run TLP, a power management tool.")))
(define (generate-tlp-documentation)
(generate-documentation
`((tlp-configuration ,tlp-configuration-fields))
'tlp-configuration))
+
+\f
+
+;;;
+;;; 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))
+ (description "Run thermald, a CPU frequency scaling service that helps
+prevent overheating.")))