unofficial mirror of guix-patches@gnu.org 
 help / color / mirror / code / Atom feed
From: Adrien 'neox' Bourmault <neox@gnu.org>
To: 70845@debbugs.gnu.org
Cc: Adrien 'neox' Bourmault <neox@gnu.org>
Subject: [bug#70845] [PATCH v2] services: Add fancontrol-service-type.
Date: Mon, 13 May 2024 16:06:27 +0200	[thread overview]
Message-ID: <b8ea66dd0b5edd9e8d345a0beda3198049ab6231.1715609187.git.neox@gnu.org> (raw)
In-Reply-To: <20240509154032.5047-1-neox@gnu.org>

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>
---
 gnu/services/pm.scm | 33 ++++++++++++++++++++++++++++++++-
 1 file changed, 32 insertions(+), 1 deletion(-)

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 @@ (define-module (gnu services pm)
             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 @@ (define thermald-service-type
    (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))))))
+

base-commit: 7b0f145802f0c2c785014293d748721678fef824
-- 
2.41.0





  parent reply	other threads:[~2024-05-13 14:08 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-05-09 15:37 [bug#70845] [PATCH] services: Add fancontrol-service-type Adrien 'neox' Bourmault
2024-05-09 17:39 ` Denis 'GNUtoo' Carikli
2024-05-09 19:28   ` Adrien 'neox' Bourmault via Guix-patches via
2024-05-09 19:30   ` Adrien 'neox' Bourmault
2024-05-12 15:17     ` Denis 'GNUtoo' Carikli
2024-05-13 14:06 ` Adrien 'neox' Bourmault [this message]
2024-05-15 22:16 ` [bug#70845] [PATCH v2] " Juliana Sims via Guix-patches via
2024-05-16  9:27   ` Adrien 'neox' Bourmault

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://guix.gnu.org/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=b8ea66dd0b5edd9e8d345a0beda3198049ab6231.1715609187.git.neox@gnu.org \
    --to=neox@gnu.org \
    --cc=70845@debbugs.gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/guix.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).