From patchwork Wed Nov 3 12:34:05 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: phodina X-Patchwork-Id: 34225 Return-Path: X-Original-To: patchwork@mira.cbaines.net Delivered-To: patchwork@mira.cbaines.net Received: by mira.cbaines.net (Postfix, from userid 113) id B578827BBE3; Wed, 3 Nov 2021 12:35:10 +0000 (GMT) X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on mira.cbaines.net X-Spam-Level: X-Spam-Status: No, score=-2.8 required=5.0 tests=BAYES_00,DKIM_SIGNED, FREEMAIL_FROM,MAILING_LIST_MULTI,RCVD_IN_MSPIKE_H2,SPF_HELO_PASS, T_DKIM_INVALID,URIBL_BLOCKED autolearn=unavailable autolearn_force=no version=3.4.2 Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mira.cbaines.net (Postfix) with ESMTPS id 6D65127BBE1 for ; Wed, 3 Nov 2021 12:35:10 +0000 (GMT) Received: from localhost ([::1]:41496 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1miFTx-00057s-KK for patchwork@mira.cbaines.net; Wed, 03 Nov 2021 08:35:09 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:47738) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1miFTq-00050J-C1 for guix-patches@gnu.org; Wed, 03 Nov 2021 08:35:02 -0400 Received: from debbugs.gnu.org ([209.51.188.43]:56091) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1miFTq-0002FQ-3v for guix-patches@gnu.org; Wed, 03 Nov 2021 08:35:02 -0400 Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1miFTp-0007Pm-T9 for guix-patches@gnu.org; Wed, 03 Nov 2021 08:35:01 -0400 X-Loop: help-debbugs@gnu.org Subject: [bug#45105] [PATCH v2] gnu: Add mbpfan service. References: <87a6ups6pd.fsf@posteo.net> In-Reply-To: <87a6ups6pd.fsf@posteo.net> Resent-From: phodina Original-Sender: "Debbugs-submit" Resent-CC: guix-patches@gnu.org Resent-Date: Wed, 03 Nov 2021 12:35:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 45105 X-GNU-PR-Package: guix-patches X-GNU-PR-Keywords: patch To: "45105@debbugs.gnu.org" <45105@debbugs.gnu.org> Received: via spool by 45105-submit@debbugs.gnu.org id=B45105.163594286028444 (code B ref 45105); Wed, 03 Nov 2021 12:35:01 +0000 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= Message-ID: MIME-Version: 1.0 X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-BeenThere: guix-patches@gnu.org List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: guix-patches-bounces+patchwork=mira.cbaines.net@gnu.org Sender: "Guix-patches" Reply-to: phodina X-ACL-Warn: , phodina via Guix-patches X-Patchwork-Original-From: phodina via Guix-patches via From: phodina X-getmail-retrieved-from-mailbox: Patches 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--- --- 2.33.1 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 +;;; +;;; 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))))