From unknown Sat Jun 14 03:52:19 2025 Content-Disposition: inline Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 X-Mailer: MIME-tools 5.509 (Entity 5.509) Content-Type: text/plain; charset=utf-8 From: bug#45105 <45105@debbugs.gnu.org> To: bug#45105 <45105@debbugs.gnu.org> Subject: Status: [PATCH] gnu: Add mbpfan service Reply-To: bug#45105 <45105@debbugs.gnu.org> Date: Sat, 14 Jun 2025 10:52:19 +0000 retitle 45105 [PATCH] gnu: Add mbpfan service reassign 45105 guix-patches submitter 45105 Niklas Eklund severity 45105 normal tag 45105 patch thanks From debbugs-submit-bounces@debbugs.gnu.org Mon Dec 07 15:27:13 2020 Received: (at submit) by debbugs.gnu.org; 7 Dec 2020 20:27:13 +0000 Received: from localhost ([127.0.0.1]:55607 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1kmN6H-0007OG-4L for submit@debbugs.gnu.org; Mon, 07 Dec 2020 15:27:13 -0500 Received: from lists.gnu.org ([209.51.188.17]:60742) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1kmN6D-0007O7-SY for submit@debbugs.gnu.org; Mon, 07 Dec 2020 15:27:11 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:40062) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1kmN6A-0004KU-83 for guix-patches@gnu.org; Mon, 07 Dec 2020 15:27:08 -0500 Received: from mout01.posteo.de ([185.67.36.65]:37980) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1kmN67-000176-6b for guix-patches@gnu.org; Mon, 07 Dec 2020 15:27:06 -0500 Received: from submission (posteo.de [89.146.220.130]) by mout01.posteo.de (Postfix) with ESMTPS id 9EB76160062 for ; Mon, 7 Dec 2020 21:27:00 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=posteo.net; s=2017; t=1607372820; bh=AhgNdg7TBzjqTLIAnyWCBRvQkIJ9tEZ8e5uMcVCZ1M8=; h=From:To:Subject:Date:From; b=muP/8/2aE5uCjSqWwlYyh1SSrYXtGIv3VnXNtn+ZgR6H/G4s5DikO5Gf8UpvrZlgw iy31NRIgiYk8RKSFhhbsl8C61vNQ9YAZlM81Ingclu9gDYW0Ld0QN5eCGmKrh7F8up xYjRqcBn1FCNH0mFGIPsmBJSc7mGK1lAptjP6FhHLrSW/nrf751nTI5GXSwKwqrsqZ DxRHZSonej8A0FDFrhW/b30Z93zWMMZEazsgbxVDOCX28ShyuRjBQjHckkFzX58fcT BxmiXeWoU1Togk+1Ui0Og1G3Hggz0KHQIDs7ZFm0DYIkXjt/t4C7NFd39YgCUBrAE+ n/jfFi9pQDhuQ== Received: from customer (localhost [127.0.0.1]) by submission (posteo.de) with ESMTPSA id 4CqZbl5hWXz6tml for ; Mon, 7 Dec 2020 21:26:59 +0100 (CET) From: Niklas Eklund To: guix-patches@gnu.org Subject: [PATCH] gnu: Add mbpfan service Date: Mon, 07 Dec 2020 21:26:54 +0100 Message-ID: <87a6ups6pd.fsf@posteo.net> MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" Received-SPF: pass client-ip=185.67.36.65; envelope-from=niklas.eklund@posteo.net; helo=mout01.posteo.de X-Spam_score_int: -43 X-Spam_score: -4.4 X-Spam_bar: ---- X-Spam_report: (-4.4 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_MED=-2.3, RCVD_IN_MSPIKE_H4=0.001, RCVD_IN_MSPIKE_WL=0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-Spam-Score: -1.3 (-) X-Debbugs-Envelope-To: submit X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -2.3 (--) --=-=-= Content-Type: text/plain 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 --=-=-= Content-Type: text/x-patch; charset=utf-8 Content-Disposition: attachment; filename=0001-gnu-Add-mbpfan-service.patch Content-Transfer-Encoding: quoted-printable Content-Description: content >From 9773af047fc3ddb337a2d9ac346a1655d2bc11ee Mon Sep 17 00:00:00 2001 From: Niklas Eklund Date: Mon, 7 Dec 2020 20:53:07 +0100 Subject: [PATCH] gnu: Add mbpfan service. * gnu/services/mbpfan.scm (mbpfan service): New variable. --- gnu/services/mbpfan.scm | 73 +++++++++++++++++++++++++++++++++++++++++ 1 file changed, 73 insertions(+) create mode 100644 gnu/services/mbpfan.scm diff --git a/gnu/services/mbpfan.scm b/gnu/services/mbpfan.scm new file mode 100644 index 0000000000..425da6baab --- /dev/null +++ b/gnu/services/mbpfan.scm @@ -0,0 +1,73 @@ +;;; GNU Guix --- Functional package management for GNU +;;; Copyright =C2=A9 2020 Niklas Eklund +;;; +;;; 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 . + +(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 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 + (($ 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-se= rvice))) + (description + "Run the MacBook/Macbook Pro fan daemon.") + (default-value (mbpfan-configuration)))) + +;;; mbpfan.scm ends here --=20 2.29.2 --=-=-=-- From debbugs-submit-bounces@debbugs.gnu.org Wed Jan 06 05:11:16 2021 Received: (at 45105) by debbugs.gnu.org; 6 Jan 2021 10:11:16 +0000 Received: from localhost ([127.0.0.1]:43503 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1kx5me-0004US-J9 for submit@debbugs.gnu.org; Wed, 06 Jan 2021 05:11:16 -0500 Received: from eggs.gnu.org ([209.51.188.92]:59966) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1kx5md-0004UG-CX for 45105@debbugs.gnu.org; Wed, 06 Jan 2021 05:11:15 -0500 Received: from fencepost.gnu.org ([2001:470:142:3::e]:57540) by eggs.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1kx5mY-0007HP-8V; Wed, 06 Jan 2021 05:11:10 -0500 Received: from [2a01:e0a:19b:d9a0:d54b:f4e5:4687:8012] (port=42986 helo=cervin) by fencepost.gnu.org with esmtpsa (TLS1.2:RSA_AES_256_CBC_SHA1:256) (Exim 4.82) (envelope-from ) id 1kx5mX-0008OB-OS; Wed, 06 Jan 2021 05:11:10 -0500 From: Mathieu Othacehe To: Niklas Eklund Subject: Re: [bug#45105] [PATCH] gnu: Add mbpfan service References: <87a6ups6pd.fsf@posteo.net> Date: Wed, 06 Jan 2021 11:11:08 +0100 In-Reply-To: <87a6ups6pd.fsf@posteo.net> (Niklas Eklund's message of "Mon, 07 Dec 2020 21:26:54 +0100") Message-ID: <877doqpe83.fsf@gnu.org> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/27.1 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain X-Spam-Score: -2.3 (--) X-Debbugs-Envelope-To: 45105 Cc: 45105@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -3.3 (---) 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 From debbugs-submit-bounces@debbugs.gnu.org Wed Nov 03 08:34:20 2021 Received: (at 45105) by debbugs.gnu.org; 3 Nov 2021 12:34:20 +0000 Received: from localhost ([127.0.0.1]:39404 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1miFTA-0007Oi-7R for submit@debbugs.gnu.org; Wed, 03 Nov 2021 08:34:20 -0400 Received: from mail-40133.protonmail.ch ([185.70.40.133]:17749) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1miFT7-0007OR-FH for 45105@debbugs.gnu.org; Wed, 03 Nov 2021 08:34:19 -0400 Date: Wed, 03 Nov 2021 12:34:05 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=protonmail.com; s=protonmail; t=1635942846; bh=TDA2QBUnlSdjoQHUZtODvLDIMqkDuL+pYdB0HHz+hGs=; h=Date:To:From:Reply-To:Subject:From; b=TuExbT9YHOVbvpoBAwkMuvv9EAABGw9lOENPjUuDhoXOyOTs91aoTNmC+jEtH3YGj wSjxTzlEqIKggALFt/+y4RemXgQMRhtHRknatJTATQj87EU97RwRxYCdM9/9Ig/oC2 xj4/F3daXuSHqIZk9lR5exGboV4/TQx4/e+5KeS4= To: "45105@debbugs.gnu.org" <45105@debbugs.gnu.org> From: phodina Subject: [PATCH v2] gnu: Add mbpfan service. Message-ID: MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable X-Spam-Status: No, score=-1.2 required=10.0 tests=ALL_TRUSTED,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FREEMAIL_FROM shortcircuit=no autolearn=disabled version=3.4.4 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on mailout.protonmail.ch X-Spam-Score: -0.0 (/) X-Debbugs-Envelope-To: 45105 X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Reply-To: phodina Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.0 (-) Hi Mathieu, here are the changes. I don't have Apple laptop, so I can't tests the servi= ce. 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 =C2=A9 2020 Niklas Eklund +;;; +;;; 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 . + +(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 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 + (($ 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 From debbugs-submit-bounces@debbugs.gnu.org Sun Jan 02 17:51:42 2022 Received: (at 45105) by debbugs.gnu.org; 2 Jan 2022 22:51:42 +0000 Received: from localhost ([127.0.0.1]:33889 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1n49hW-0008Tc-8q for submit@debbugs.gnu.org; Sun, 02 Jan 2022 17:51:42 -0500 Received: from mail-wm1-f51.google.com ([209.85.128.51]:54130) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1n45Cl-0004ee-Su for 45105@debbugs.gnu.org; Sun, 02 Jan 2022 13:03:40 -0500 Received: by mail-wm1-f51.google.com with SMTP id l4so20273934wmq.3 for <45105@debbugs.gnu.org>; Sun, 02 Jan 2022 10:03:39 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=from:to:subject:date:message-id:mime-version :content-transfer-encoding; bh=jEy542yM6wbsBjSmyCDFUetKuJ2c8R0oMFhI9untU/8=; b=YF4jw0Do/5i0l6zZSCJO7tBkPNLnlOZxZJj2xdOFOQ7iP2yoopsc06FFT+Zcz7AHJU 6Tln2ls9ABLDA8tWirRB3m+cxra2r9WfUX7czHhjqJdFV+cGtmo7NSWoxdKZySw66YAw 8O955Z+Ad0+w+3KqQorWfHbWCAPe1nV9P9n1FlHWq525rzGpRvbCpQyvVdnO2egDkuD9 l5xwtpKd0FeVIR/Ns4LYwD0Ni1J40oJsiiB8Ktaqxfr6EXADmSDZtLOeZyhIbBegZDah fyYvMSXywIIoUT5vKo0Hnun6aFHeGfaXSZsSWcmCej02+u/cNAvXCJHSOIa88aGiRpab 1cTA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:subject:date:message-id:mime-version :content-transfer-encoding; bh=jEy542yM6wbsBjSmyCDFUetKuJ2c8R0oMFhI9untU/8=; b=moxyRhfGlTPdYcdjMM8gmUjugK//LfB6NATdi2gqj2e7pPihzEXQA9a5DBWfEP33j1 UC56CzPbRoa4Fo+EgNoyu8j0cr8+bQ59VYeKIwnXIFPAmt04A4SN78vbschTVp64Y5G7 Rlp1MVql1If8zrYajm+z4lbJPY7xwmfsX3yqJ5gje9t0v8nkBKp0J/ty8At6T2yRMBRL 6hwFylUUlWLnzrYYZsBXwzOJtKIVdfzihxR2rJxr/wMkrCszVKsK3/l1JX28+7T4/W/Q j3Yg0fJ8oFS5iN0HGceAEZLscStrr8g1YwyVi8/CHCjH2tMCKnYLrSXy6EoCrlDcks2E b8Rg== X-Gm-Message-State: AOAM531772UuwxvPLOA/Z+pibflwPE5UEZxUcmtC0j8QLYALYIn3DLMY 2Q275tNoYfKakchSUnZhEsj57LRVrgcyng== X-Google-Smtp-Source: ABdhPJwHcz2pSvG8poQs50ELWnxb+c19fj8X30MnPM9kK7zvhAf96gt9UHFbCGa7+XcTtnzhq7UXjA== X-Received: by 2002:a05:600c:c6:: with SMTP id u6mr8536304wmm.50.1641146613954; Sun, 02 Jan 2022 10:03:33 -0800 (PST) Received: from mbp ([185.39.42.151]) by smtp.gmail.com with ESMTPSA id i15sm23181362wrf.6.2022.01.02.10.03.32 for <45105@debbugs.gnu.org> (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 02 Jan 2022 10:03:33 -0800 (PST) From: Jorge Acereda To: 45105@debbugs.gnu.org Subject: [PATCH v3] gnu: Add mbpfan service. Date: Sun, 02 Jan 2022 19:03:28 +0100 Message-ID: <87bl0uypzj.fsf@gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable X-Spam-Score: 0.0 (/) X-Debbugs-Envelope-To: 45105 X-Mailman-Approved-At: Sun, 02 Jan 2022 17:51:40 -0500 X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.0 (-) 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.jacere= da@gmail.com> From: Jorge Acereda 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 =3D \ %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 =C2=A9 2020 Niklas Eklund +;;; +;;; 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 . + +(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 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 + (($ 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)))) --=20 2.34.0