GNU bug report logs - #45105
[PATCH] gnu: Add mbpfan service

Previous Next

Package: guix-patches;

Reported by: Niklas Eklund <niklas.eklund <at> posteo.net>

Date: Mon, 7 Dec 2020 20:28:01 UTC

Severity: normal

Tags: patch

To reply to this bug, email your comments to 45105 AT debbugs.gnu.org.

Toggle the display of automated, internal messages from the tracker.

View this report as an mbox folder, status mbox, maintainer mbox


Report forwarded to guix-patches <at> gnu.org:
bug#45105; Package guix-patches. (Mon, 07 Dec 2020 20:28:01 GMT) Full text and rfc822 format available.

Acknowledgement sent to Niklas Eklund <niklas.eklund <at> posteo.net>:
New bug report received and forwarded. Copy sent to guix-patches <at> gnu.org. (Mon, 07 Dec 2020 20:28:01 GMT) Full text and rfc822 format available.

Message #5 received at submit <at> debbugs.gnu.org (full text, mbox):

From: Niklas Eklund <niklas.eklund <at> posteo.net>
To: guix-patches <at> gnu.org
Subject: [PATCH] gnu: Add mbpfan service
Date: Mon, 07 Dec 2020 21:26:54 +0100
[Message part 1 (text/plain, inline)]
Hi,

this is a patch that adds the service for mbpfan. The mbpfan package
that exists in guix requires sudo rights to run. So I have been using
this service for a while and thought it was a good time to try to merge
it upstream :)

Cheers

[0001-gnu-Add-mbpfan-service.patch (text/x-patch, attachment)]

Information forwarded to guix-patches <at> gnu.org:
bug#45105; Package guix-patches. (Wed, 06 Jan 2021 10:12:01 GMT) Full text and rfc822 format available.

Message #8 received at 45105 <at> debbugs.gnu.org (full text, mbox):

From: Mathieu Othacehe <othacehe <at> gnu.org>
To: Niklas Eklund <niklas.eklund <at> posteo.net>
Cc: 45105 <at> debbugs.gnu.org
Subject: Re: [bug#45105] [PATCH] gnu: Add mbpfan service
Date: Wed, 06 Jan 2021 11:11:08 +0100
Hello Niklas,

> * gnu/services/mbpfan.scm (mbpfan service): New variable.

Thanks for your contribution and sorry for the late review.

> +                       #$@(if verbose?
> +                            '("-v") ; verbose logging
> +                            '()))
> +                 #:log-file #$log-file))

The indentation is off here.

> +    (list (service-extension shepherd-root-service-type mbpfan-shepherd-service)))

You should wrap this line to stay under the 78 cols limit.

You also need to add this file to 'gnu/local.mk'. It would also be nice
to write some documentation, probably under "Power management services".

Could you please send an updated patch?

Thanks,

Mathieu




Information forwarded to guix-patches <at> gnu.org:
bug#45105; Package guix-patches. (Wed, 03 Nov 2021 12:35:01 GMT) Full text and rfc822 format available.

Message #11 received at 45105 <at> debbugs.gnu.org (full text, mbox):

From: phodina <phodina <at> protonmail.com>
To: "45105 <at> debbugs.gnu.org" <45105 <at> debbugs.gnu.org>
Subject: [PATCH v2] gnu: Add mbpfan service.
Date: Wed, 03 Nov 2021 12:34:05 +0000
Hi Mathieu,

here are the changes. I don't have Apple laptop, so I can't tests the service.

Petr

* gnu/services/mbpfan.scm (mbpfan service): New variable.

--8<---------------cut here---------------start------------->8---

diff --git a/gnu/services/mbpfan.scm b/gnu/services/mbpfan.scm
new file mode 100644
index 0000000000..493ca70bb7
--- /dev/null
+++ b/gnu/services/mbpfan.scm
@@ -0,0 +1,72 @@
+;;; GNU Guix --- Functional package management for GNU
+;;; Copyright © 2020 Niklas Eklund <niklas.eklund <at> posteo.net>
+;;;
+;;; This file is part of GNU Guix.
+;;;
+;;; 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.
+;;;
+;;; GNU Guix is distributed in the hope that it will be useful, but
+;;; WITHOUT ANY WARRANTY; without even the implied warranty of
+;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+;;; GNU General Public License for more details.
+;;;
+;;; You should have received a copy of the GNU General Public License
+;;; along with GNU Guix.  If not, see <http://www.gnu.org/licenses/>.
+
+(define-module (gnu services mbpfan)
+  #:use-module (gnu packages linux)
+  #:use-module (gnu services)
+  #:use-module (gnu services base)
+  #:use-module (gnu services shepherd)
+  #:use-module (guix gexp)
+  #:use-module (guix records)
+  #:use-module (ice-9 match)
+  #:use-module (ice-9 format)
+  #:use-module (guix modules)
+  #:export (mbpfan-service-type
+
+            mbpfan-configuration
+            mbpfan-configuration?))
+
+;;; Commentary:
+;;;
+;;; This module provides a service definition for the mbpfan.
+;;;
+;;; Code:
+
+(define-record-type* <mbpfan-configuration>
+  mbpfan-configuration make-mbpfan-configuration
+  mbpfan-configuration?
+  (log-file mbpfan-configuration-log-file ;string
+            (default "/var/log/mbpfan.log"))
+  (verbose? mbpfan-configuration-verbose? (default #f)))
+
+(define mbpfan-shepherd-service
+  (match-lambda
+    (($ <mbpfan-configuration> log-file verbose?)
+     (list
+      (shepherd-service
+       (documentation "Run the mbpfan daemon.")
+       (provision '(mbpfan))
+       (requirement '(syslogd))
+       (start #~(make-forkexec-constructor
+                 (list #$(file-append mbpfan "/sbin/mbpfan")
+                       "-f"
+                       #$@(if verbose?
+                              '("-v")   ; verbose logging
+                              '()))
+                 #:log-file #$log-file))
+       (stop #~(make-kill-destructor)))))))
+
+(define mbpfan-service-type
+  (service-type
+   (name 'mbpfan)
+   (extensions
+    (list (service-extension shepherd-root-service-type
+                             mbpfan-shepherd-service)))
+   (description
+    "Run the MacBook/Macbook Pro fan daemon.")
+   (default-value (mbpfan-configuration))))
--
2.33.1




Information forwarded to guix-patches <at> gnu.org:
bug#45105; Package guix-patches. (Sun, 02 Jan 2022 22:52:02 GMT) Full text and rfc822 format available.

Message #14 received at 45105 <at> debbugs.gnu.org (full text, mbox):

From: Jorge Acereda <jacereda <at> gmail.com>
To: 45105 <at> debbugs.gnu.org
Subject: [PATCH v3] gnu: Add mbpfan service.
Date: Sun, 02 Jan 2022 19:03:28 +0100
Hi,

I've added the service to gnu/local.mk, verified it can correctly
start/stop and been using it for some days without problems.

Regards,
  Jorge Acereda

From 186bd7c2c37b11e3e8a3314ef77bcaf9e993b642 Mon Sep 17 00:00:00 2001
Message-Id: <186bd7c2c37b11e3e8a3314ef77bcaf9e993b642.1641146492.git.jacereda <at> gmail.com>
From: Jorge Acereda <jacereda <at> gmail.com>
Date: Wed, 29 Dec 2021 23:44:59 +0100
Subject: [PATCH v3] gnu: Add mbpfan service

---
 gnu/local.mk            |  1 +
 gnu/services/mbpfan.scm | 72 +++++++++++++++++++++++++++++++++++++++++
 2 files changed, 73 insertions(+)
 create mode 100644 gnu/services/mbpfan.scm

diff --git a/gnu/local.mk b/gnu/local.mk
index 68a83f5cf8..ac9ed76e68 100644
--- a/gnu/local.mk
+++ b/gnu/local.mk
@@ -652,6 +652,7 @@ GNU_SYSTEM_MODULES =				\
   %D%/services/lirc.scm				\
   %D%/services/virtualization.scm		\
   %D%/services/mail.scm				\
+  %D%/services/mbpfan.scm			\
   %D%/services/mcron.scm			\
   %D%/services/messaging.scm			\
   %D%/services/monitoring.scm			\
diff --git a/gnu/services/mbpfan.scm b/gnu/services/mbpfan.scm
new file mode 100644
index 0000000000..493ca70bb7
--- /dev/null
+++ b/gnu/services/mbpfan.scm
@@ -0,0 +1,72 @@
+;;; GNU Guix --- Functional package management for GNU
+;;; Copyright © 2020 Niklas Eklund <niklas.eklund <at> posteo.net>
+;;;
+;;; This file is part of GNU Guix.
+;;;
+;;; 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.
+;;;
+;;; GNU Guix is distributed in the hope that it will be useful, but
+;;; WITHOUT ANY WARRANTY; without even the implied warranty of
+;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+;;; GNU General Public License for more details.
+;;;
+;;; You should have received a copy of the GNU General Public License
+;;; along with GNU Guix.  If not, see <http://www.gnu.org/licenses/>.
+
+(define-module (gnu services mbpfan)
+  #:use-module (gnu packages linux)
+  #:use-module (gnu services)
+  #:use-module (gnu services base)
+  #:use-module (gnu services shepherd)
+  #:use-module (guix gexp)
+  #:use-module (guix records)
+  #:use-module (ice-9 match)
+  #:use-module (ice-9 format)
+  #:use-module (guix modules)
+  #:export (mbpfan-service-type
+
+            mbpfan-configuration
+            mbpfan-configuration?))
+
+;;; Commentary:
+;;;
+;;; This module provides a service definition for the mbpfan.
+;;;
+;;; Code:
+
+(define-record-type* <mbpfan-configuration>
+  mbpfan-configuration make-mbpfan-configuration
+  mbpfan-configuration?
+  (log-file mbpfan-configuration-log-file ;string
+            (default "/var/log/mbpfan.log"))
+  (verbose? mbpfan-configuration-verbose? (default #f)))
+
+(define mbpfan-shepherd-service
+  (match-lambda
+    (($ <mbpfan-configuration> log-file verbose?)
+     (list
+      (shepherd-service
+       (documentation "Run the mbpfan daemon.")
+       (provision '(mbpfan))
+       (requirement '(syslogd))
+       (start #~(make-forkexec-constructor
+                 (list #$(file-append mbpfan "/sbin/mbpfan")
+                       "-f"
+                       #$@(if verbose?
+                              '("-v")   ; verbose logging
+                              '()))
+                 #:log-file #$log-file))
+       (stop #~(make-kill-destructor)))))))
+
+(define mbpfan-service-type
+  (service-type
+   (name 'mbpfan)
+   (extensions
+    (list (service-extension shepherd-root-service-type
+                             mbpfan-shepherd-service)))
+   (description
+    "Run the MacBook/Macbook Pro fan daemon.")
+   (default-value (mbpfan-configuration))))
-- 
2.34.0





This bug report was last modified 2 years and 107 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.