X-Git-Url: https://git.hcoop.net/jackhill/guix/guix.git/blobdiff_plain/c17383f400d3b942c22ec46b556cad8ca3a2fce1..f129ca0b181f2f08e8b7c9c263ad2520a4ef717d:/gnu/services/pm.scm diff --git a/gnu/services/pm.scm b/gnu/services/pm.scm index ec35e5701a..256c6a7fa7 100644 --- a/gnu/services/pm.scm +++ b/gnu/services/pm.scm @@ -3,7 +3,7 @@ ;;; ;;; 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. @@ -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))) @@ -327,7 +331,7 @@ blacklisted ones.") (runtime-pm-blacklist (maybe-space-separated-string-list 'disabled) - "Exclude specified PCI(e) devices adresses from Runtime Power Management.") + "Exclude specified PCI(e) device addresses from Runtime Power Management.") (runtime-pm-driver-blacklist (space-separated-string-list '("radeon" "nouveau")) @@ -384,7 +388,7 @@ shutdown on system startup.")) (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 @@ -396,9 +400,48 @@ shutdown on system startup.")) (service-extension udev-service-type (compose list tlp-configuration-tlp)) (service-extension activation-service-type - tlp-activation))))) + tlp-activation))) + (default-value (tlp-configuration)) + (description "Run TLP, a power management tool."))) (define (generate-tlp-documentation) (generate-documentation `((tlp-configuration ,tlp-configuration-fields)) 'tlp-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? ;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.")))