unofficial mirror of guix-patches@gnu.org 
 help / color / mirror / code / Atom feed
From: phodina via Guix-patches via <guix-patches@gnu.org>
To: "45105@debbugs.gnu.org" <45105@debbugs.gnu.org>
Subject: [bug#45105] [PATCH v2] gnu: Add mbpfan service.
Date: Wed, 03 Nov 2021 12:34:05 +0000	[thread overview]
Message-ID: <LvEzWYXWBqwIjDXje3LYXlOUOZsjFOttrH45miPXLMyAGgK1-osqDt_Nk888IhtltIEaR0OZU7JqZsB0OVi-_0QLaaD5EF-iKoLO11fjGv8=@protonmail.com> (raw)
In-Reply-To: <87a6ups6pd.fsf@posteo.net>

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@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




  parent reply	other threads:[~2021-11-03 12:35 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-12-07 20:26 [bug#45105] [PATCH] gnu: Add mbpfan service Niklas Eklund
2021-01-06 10:11 ` Mathieu Othacehe
2021-11-03 12:34 ` phodina via Guix-patches via [this message]
2022-01-02 18:03 ` [bug#45105] [PATCH v3] " Jorge Acereda

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='LvEzWYXWBqwIjDXje3LYXlOUOZsjFOttrH45miPXLMyAGgK1-osqDt_Nk888IhtltIEaR0OZU7JqZsB0OVi-_0QLaaD5EF-iKoLO11fjGv8=@protonmail.com' \
    --to=guix-patches@gnu.org \
    --cc=45105@debbugs.gnu.org \
    --cc=phodina@protonmail.com \
    /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).