summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAdrien 'neox' Bourmault <neox@gnu.org>2024-05-13 16:06:27 +0200
committerGuix Patches Tester <>2024-05-13 16:19:31 +0200
commitcb220f786ec1d315cd753275b0b5f064383db836 (patch)
tree0812755016970d86c292e9e8c665ea504da67be7
parent56980ea500a1db3c8586972b8abfaf5c4e24f82d (diff)
downloadguix-patches-issue-70845.tar
guix-patches-issue-70845.tar.gz
services: Add fancontrol-service-type.issue-70845
Hi! I've created a fancontrol service for my own use on a KGPE-D16 workstation, and wanted to share it with GNU Guix. The configuration has to be generated upstream with pwmconfig (lm-sensors package) and you just have to tell the service where it is for it to work. This is the second version of this patch, fixing the lack of copyright notice and dot at the end of the commit message. Change-Id: I120e54cbf849eebd088be2a4d0a0113ffcdfcd84 Signed-off-by: Adrien 'neox' Bourmault <neox@gnu.org>
-rw-r--r--gnu/services/pm.scm33
1 files changed, 32 insertions, 1 deletions
diff --git a/gnu/services/pm.scm b/gnu/services/pm.scm
index 3daf484cc1..2196673875 100644
--- a/gnu/services/pm.scm
+++ b/gnu/services/pm.scm
@@ -1,5 +1,6 @@
;;; GNU Guix --- Functional package management for GNU
;;; Copyright © 2017 Mathieu Othacehe <m.othacehe@gmail.com>
+;;; Copyright © 2024 Adrien 'neox' Bourmault <neox@gnu.org>
;;;
;;; This file is part of GNU Guix.
;;;
@@ -31,7 +32,9 @@
tlp-configuration
thermald-configuration
- thermald-service-type))
+ thermald-service-type
+
+ fancontrol-service-type))
(define (uglify-field-name field-name)
(let ((str (symbol->string field-name)))
@@ -466,3 +469,31 @@ shutdown on system startup."))
(default-value (thermald-configuration))
(description "Run thermald, a CPU frequency scaling service that helps
prevent overheating.")))
+
+;;;
+;;; fancontrol
+;;;
+;;; This service implements fan control in conjunction with the tools in the
+;;; lm-sensors package (pwmconfig/fancontrol).
+
+(define (fancontrol-shepherd-service config)
+ (shepherd-service
+ (documentation "Run the fancontrol daemon (fancontrol-daemon)." )
+ (provision '(fancontrol))
+ (requirement '(udev user-processes))
+ (start #~(make-forkexec-constructor
+ (list #$(file-append lm-sensors "/sbin/fancontrol")
+ #$config)
+ #:user "root" #:group "root"
+ #:log-file "/var/log/fancontrol.log"))
+ (stop #~(make-kill-destructor))))
+
+(define fancontrol-service-type
+ (service-type
+ (name 'fancontrol)
+ (description
+ "Run fancontrol as a daemon.")
+ (extensions
+ (list (service-extension shepherd-root-service-type
+ (compose list fancontrol-shepherd-service))))))
+