X-Loop: help-debbugs@HIDDEN Subject: [bug#75021] [PATCH] services: Add mosquitto-service-type. Resent-From: Evgeny Pisemsky <mail@HIDDEN> Original-Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org> Resent-CC: guix-patches@HIDDEN Resent-Date: Sun, 22 Dec 2024 09:12:01 +0000 Resent-Message-ID: <handler.75021.B.1734858671559 <at> debbugs.gnu.org> Resent-Sender: help-debbugs@HIDDEN X-GNU-PR-Message: report 75021 X-GNU-PR-Package: guix-patches X-GNU-PR-Keywords: patch To: 75021 <at> debbugs.gnu.org X-Debbugs-Original-To: guix-patches@HIDDEN Received: via spool by submit <at> debbugs.gnu.org id=B.1734858671559 (code B ref -1); Sun, 22 Dec 2024 09:12:01 +0000 Received: (at submit) by debbugs.gnu.org; 22 Dec 2024 09:11:11 +0000 Received: from localhost ([127.0.0.1]:49003 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>) id 1tPHzS-00008x-Kn for submit <at> debbugs.gnu.org; Sun, 22 Dec 2024 04:11:11 -0500 Received: from lists.gnu.org ([209.51.188.17]:47476) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from <mail@HIDDEN>) id 1tPHzQ-00008n-8P for submit <at> debbugs.gnu.org; Sun, 22 Dec 2024 04:11:09 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from <mail@HIDDEN>) id 1tPHzO-0004TG-Jn for guix-patches@HIDDEN; Sun, 22 Dec 2024 04:11:06 -0500 Received: from sofi-shared.hosting.energy ([2001:41d0:602:1f56::] helo=sofi.hosting.energy) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from <mail@HIDDEN>) id 1tPHzJ-0003eD-65 for guix-patches@HIDDEN; Sun, 22 Dec 2024 04:11:05 -0500 Received: from [212.233.86.182] (helo=laptop) by sofi.hosting.energy with esmtpsa (TLS1.2) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94) (envelope-from <mail@HIDDEN>) id 1tPHzB-00046n-FC for guix-patches@HIDDEN; Sun, 22 Dec 2024 12:10:53 +0300 From: Evgeny Pisemsky <mail@HIDDEN> Date: Sun, 22 Dec 2024 12:10:51 +0300 Message-ID: <87cyhkytes.fsf@HIDDEN> User-Agent: Gnus/5.13 (Gnus v5.13) MIME-Version: 1.0 Content-Type: text/x-patch; charset=utf-8 Content-Disposition: inline; filename=0001-services-Add-mosquitto-service-type.patch Content-Transfer-Encoding: quoted-printable Received-SPF: permerror client-ip=2001:41d0:602:1f56::; envelope-from=mail@HIDDEN; helo=sofi.hosting.energy X-Spam_score_int: -14 X-Spam_score: -1.5 X-Spam_bar: - X-Spam_report: (-1.5 / 5.0 requ) BAYES_00=-1.9, KHOP_HELO_FCRDNS=0.4, T_SPF_HELO_PERMERROR=0.01, T_SPF_PERMERROR=0.01 autolearn=no autolearn_force=no X-Spam_action: no action X-Spam-Score: -1.3 (-) X-BeenThere: debbugs-submit <at> debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: <debbugs-submit.debbugs.gnu.org> List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe> List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/> List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org> List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help> List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe> Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org> X-Spam-Score: -2.3 (--) From b7dce453fc4dd29309687b2eb5bea99663b44212 Mon Sep 17 00:00:00 2001 Message-ID: <b7dce453fc4dd29309687b2eb5bea99663b44212.1734858256.git.mail@p= isemsky.site> From: Evgeny Pisemsky <mail@HIDDEN> Date: Sun, 22 Dec 2024 12:00:50 +0300 Subject: [PATCH] services: Add mosquitto-service-type. Change-Id: I65c141a1aac4a932a8eead86626e4284346c1d91 --- doc/guix.texi | 32 +++++++++++++++++ gnu/services/messaging.scm | 71 +++++++++++++++++++++++++++++++++++++- 2 files changed, 102 insertions(+), 1 deletion(-) diff --git a/doc/guix.texi b/doc/guix.texi index f7b7569887..55cfbbceac 100644 --- a/doc/guix.texi +++ b/doc/guix.texi @@ -134,6 +134,7 @@ Copyright @copyright{} 2024 Nigko Yerden@* Copyright @copyright{} 2024 Troy Figiel@* Copyright @copyright{} 2024 Sharlatan Hellseher@* +Copyright @copyright{} 2024 Evgeny Pisemsky@* =20 Permission is granted to copy, distribute and/or modify this document under the terms of the GNU Free Documentation License, Version 1.3 or @@ -29403,6 +29404,37 @@ Messaging Services @end table @end deftp =20 +@subsubheading Mosquitto Service + +@url{https://mosquitto.org/,Mosquitto} is a lightweight message broker +that implements the MQTT protocol versions 5.0, 3.1.1 and 3.1. It is +suitable for use on all devices from low power single board computers to +full servers. + +@defvar mosquitto-service-type +This is the service type for the @url{https://mosquitto.org/,Mosquitto} +MQTT broker. Its value is a @code{mosquitto-configuration} (see below). +@end defvar + +@deftp {Data Type} mosquitto-configuration +This is the configuration for Mosquitto, with the following fields: + +@table @asis +@item @code{package} (default: @code{mosquitto}) +The Mosquitto package to use. + +@item @code{config-file} (default: @code{#f}) +The Mosquitto configuration file as a file-like object or the value +@code{#f} to use the default configuration. + +@item @code{user} (default: @code{"mosquitto"}) +Owner of the broker process. + +@item @code{group} (default: @code{"mosquitto"}) +Owner's group of the broker process. +@end table +@end deftp + @node Telephony Services @subsection Telephony Services =20 diff --git a/gnu/services/messaging.scm b/gnu/services/messaging.scm index a914d0f89e..056aa8b207 100644 --- a/gnu/services/messaging.scm +++ b/gnu/services/messaging.scm @@ -3,6 +3,7 @@ ;;; Copyright =C2=A9 2017 Mathieu Othacehe <m.othacehe@HIDDEN> ;;; Copyright =C2=A9 2015, 2017-2020, 2022-2024 Ludovic Court=C3=A8s <ludo= @gnu.org> ;;; Copyright =C2=A9 2018 Pierre-Antoine Rouby <contact@HIDDEN> +;;; Copyright =C2=A9 2024 Evgeny Pisemsky <mail@HIDDEN> ;;; ;;; This file is part of GNU Guix. ;;; @@ -59,7 +60,15 @@ (define-module (gnu services messaging) bitlbee-service-type =20 quassel-configuration - quassel-service-type)) + quassel-service-type + + mosquitto-configuration + mosquitto-configuration? + mosquitto-configuration-package + mosquitto-configuration-config-file + mosquitto-configuration-user + mosquitto-configuration-group + mosquitto-service-type)) =20 ;;; Commentary: ;;; @@ -1002,3 +1011,63 @@ (define quassel-service-type "Run @url{https://quassel-irc.org/,quasselcore}, the back= end for the distributed IRC client quassel, which allows you to connect from multiple machines simultaneously."))) + +;;; +;;; Mosquitto. +;;; + +(define-record-type* <mosquitto-configuration> + mosquitto-configuration + make-mosquitto-configuration + mosquitto-configuration? + (package mosquitto-configuration-package + (default mosquitto)) + (config-file mosquitto-configuration-config-file + (default #f)) + (user mosquitto-configuration-user + (default "mosquitto")) + (group mosquitto-configuration-group + (default "mosquitto"))) + +(define (mosquitto-accounts config) + (match-record config <mosquitto-configuration> + (user group) + (filter identity + (list + (and (equal? group "mosquitto") + (user-group + (name "mosquitto") + (system? #t))) + (and (equal? user "mosquitto") + (user-account + (name "mosquitto") + (group group) + (system? #t) + (comment "bzzz") + (home-directory "/var/empty") + (shell (file-append shadow "/sbin/nologin")))))))) + +(define (mosquitto-shepherd-service config) + (match-record config <mosquitto-configuration> + (package config-file user group) + (list (shepherd-service + (documentation "Run the Mosquitto MQTT broker.") + (provision '(mosquitto)) + (requirement '(networking syslogd user-processes)) + (start #~(make-forkexec-constructor + (list #$(file-append package "/sbin/mosquitto") + #$@(if config-file + (list "-c" config-file) + '())) + #:user #$user + #:group #$group)) + (stop #~(make-kill-destructor)))))) + +(define mosquitto-service-type + (service-type + (description "Run the Mosquitto MQTT broker.") + (name 'mosquitto) + (extensions + (list (service-extension account-service-type mosquitto-accounts) + (service-extension shepherd-root-service-type mosquitto-shepherd= -service))) + (default-value (mosquitto-configuration)))) base-commit: 02e6fa8f923849afa0d46f81262936880000664f --=20 2.46.0
Content-Disposition: inline Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 X-Mailer: MIME-tools 5.505 (Entity 5.505) Content-Type: text/plain; charset=utf-8 X-Loop: help-debbugs@HIDDEN From: help-debbugs@HIDDEN (GNU bug Tracking System) To: Evgeny Pisemsky <mail@HIDDEN> Subject: bug#75021: Acknowledgement ([PATCH] services: Add mosquitto-service-type.) Message-ID: <handler.75021.B.1734858671559.ack <at> debbugs.gnu.org> References: <87cyhkytes.fsf@HIDDEN> X-Gnu-PR-Message: ack 75021 X-Gnu-PR-Package: guix-patches X-Gnu-PR-Keywords: patch Reply-To: 75021 <at> debbugs.gnu.org Date: Sun, 22 Dec 2024 09:12:02 +0000 Thank you for filing a new bug report with debbugs.gnu.org. This is an automatically generated reply to let you know your message has been received. Your message is being forwarded to the package maintainers and other interested parties for their attention; they will reply in due course. Your message has been sent to the package maintainer(s): guix-patches@HIDDEN If you wish to submit further information on this problem, please send it to 75021 <at> debbugs.gnu.org. Please do not send mail to help-debbugs@HIDDEN unless you wish to report a problem with the Bug-tracking system. --=20 75021: https://debbugs.gnu.org/cgi/bugreport.cgi?bug=3D75021 GNU Bug Tracking System Contact help-debbugs@HIDDEN with problems
X-Loop: help-debbugs@HIDDEN Subject: [bug#75021] [PATCH] services: Add mosquitto-service-type. References: <87cyhkytes.fsf@HIDDEN> In-Reply-To: <87cyhkytes.fsf@HIDDEN> Resent-From: Evgeny Pisemsky <mail@HIDDEN> Original-Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org> Resent-CC: guix-patches@HIDDEN Resent-Date: Fri, 27 Dec 2024 15:33:02 +0000 Resent-Message-ID: <handler.75021.B75021.173531356829772 <at> debbugs.gnu.org> Resent-Sender: help-debbugs@HIDDEN X-GNU-PR-Message: followup 75021 X-GNU-PR-Package: guix-patches X-GNU-PR-Keywords: patch To: 75021 <at> debbugs.gnu.org Received: via spool by 75021-submit <at> debbugs.gnu.org id=B75021.173531356829772 (code B ref 75021); Fri, 27 Dec 2024 15:33:02 +0000 Received: (at 75021) by debbugs.gnu.org; 27 Dec 2024 15:32:48 +0000 Received: from localhost ([127.0.0.1]:47261 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>) id 1tRCKV-0007k4-5s for submit <at> debbugs.gnu.org; Fri, 27 Dec 2024 10:32:47 -0500 Received: from sofi-shared.hosting.energy ([146.59.24.90]:36493 helo=sofi.hosting.energy) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from <mail@HIDDEN>) id 1tRCKQ-0007jf-N6 for 75021 <at> debbugs.gnu.org; Fri, 27 Dec 2024 10:32:45 -0500 Received: from [212.233.86.93] (helo=laptop) by sofi.hosting.energy with esmtpsa (TLS1.2) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94) (envelope-from <mail@HIDDEN>) id 1tRCIG-0002Nl-Qx for 75021 <at> debbugs.gnu.org; Fri, 27 Dec 2024 18:30:29 +0300 From: Evgeny Pisemsky <mail@HIDDEN> Date: Fri, 27 Dec 2024 18:30:26 +0300 Message-ID: <87h66prvn1.fsf@HIDDEN> User-Agent: Gnus/5.13 (Gnus v5.13) MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" X-Spam-Score: 0.0 (/) X-BeenThere: debbugs-submit <at> debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: <debbugs-submit.debbugs.gnu.org> List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe> List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/> List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org> List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help> List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe> Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org> X-Spam-Score: -1.0 (-) --=-=-= Content-Type: text/plain I have described changes in a commit message. --=-=-= Content-Type: text/x-patch; charset=utf-8 Content-Disposition: attachment; filename=0001-services-Add-mosquitto-service-type.patch Content-Transfer-Encoding: quoted-printable From 06968ec1b2849441633be2392160dc2793e676ac Mon Sep 17 00:00:00 2001 Message-ID: <06968ec1b2849441633be2392160dc2793e676ac.1735312937.git.mail@p= isemsky.site> From: Evgeny Pisemsky <mail@HIDDEN> Date: Fri, 27 Dec 2024 18:18:01 +0300 Subject: [PATCH] services: Add mosquitto-service-type. * gnu/services/messaging.scm (<mosquitto-configuration>): New record type. (mosquitto-accounts): New procedure. (mosquitto-shepherd-service): New procedure. (mosquitto-service-type): New variable. * doc/guix.texi (Messaging Services): Document it. Change-Id: I65c141a1aac4a932a8eead86626e4284346c1d91 --- doc/guix.texi | 32 +++++++++++++++++ gnu/services/messaging.scm | 71 +++++++++++++++++++++++++++++++++++++- 2 files changed, 102 insertions(+), 1 deletion(-) diff --git a/doc/guix.texi b/doc/guix.texi index da4d2f5ebc..80ebfe4cae 100644 --- a/doc/guix.texi +++ b/doc/guix.texi @@ -134,6 +134,7 @@ Copyright @copyright{} 2024 Nigko Yerden@* Copyright @copyright{} 2024 Troy Figiel@* Copyright @copyright{} 2024 Sharlatan Hellseher@* +Copyright @copyright{} 2024 Evgeny Pisemsky@* =20 Permission is granted to copy, distribute and/or modify this document under the terms of the GNU Free Documentation License, Version 1.3 or @@ -29414,6 +29415,37 @@ Messaging Services @end table @end deftp =20 +@subsubheading Mosquitto Service + +@url{https://mosquitto.org/,Mosquitto} is a lightweight message broker +that implements the MQTT protocol versions 5.0, 3.1.1 and 3.1. It is +suitable for use on all devices from low power single board computers to +full servers. + +@defvar mosquitto-service-type +This is the service type for the @url{https://mosquitto.org/,Mosquitto} +MQTT broker. Its value is a @code{mosquitto-configuration} (see below). +@end defvar + +@deftp {Data Type} mosquitto-configuration +This is the configuration for Mosquitto, with the following fields: + +@table @asis +@item @code{package} (default: @code{mosquitto}) +The Mosquitto package to use. + +@item @code{config-file} (default: @code{#f}) +The Mosquitto configuration file as a file-like object or the value +@code{#f} to use the default configuration. + +@item @code{user} (default: @code{"mosquitto"}) +Owner of the broker process. + +@item @code{group} (default: @code{"mosquitto"}) +Owner's group of the broker process. +@end table +@end deftp + @node Telephony Services @subsection Telephony Services =20 diff --git a/gnu/services/messaging.scm b/gnu/services/messaging.scm index a914d0f89e..056aa8b207 100644 --- a/gnu/services/messaging.scm +++ b/gnu/services/messaging.scm @@ -3,6 +3,7 @@ ;;; Copyright =C2=A9 2017 Mathieu Othacehe <m.othacehe@HIDDEN> ;;; Copyright =C2=A9 2015, 2017-2020, 2022-2024 Ludovic Court=C3=A8s <ludo= @gnu.org> ;;; Copyright =C2=A9 2018 Pierre-Antoine Rouby <contact@HIDDEN> +;;; Copyright =C2=A9 2024 Evgeny Pisemsky <mail@HIDDEN> ;;; ;;; This file is part of GNU Guix. ;;; @@ -59,7 +60,15 @@ (define-module (gnu services messaging) bitlbee-service-type =20 quassel-configuration - quassel-service-type)) + quassel-service-type + + mosquitto-configuration + mosquitto-configuration? + mosquitto-configuration-package + mosquitto-configuration-config-file + mosquitto-configuration-user + mosquitto-configuration-group + mosquitto-service-type)) =20 ;;; Commentary: ;;; @@ -1002,3 +1011,63 @@ (define quassel-service-type "Run @url{https://quassel-irc.org/,quasselcore}, the back= end for the distributed IRC client quassel, which allows you to connect from multiple machines simultaneously."))) + +;;; +;;; Mosquitto. +;;; + +(define-record-type* <mosquitto-configuration> + mosquitto-configuration + make-mosquitto-configuration + mosquitto-configuration? + (package mosquitto-configuration-package + (default mosquitto)) + (config-file mosquitto-configuration-config-file + (default #f)) + (user mosquitto-configuration-user + (default "mosquitto")) + (group mosquitto-configuration-group + (default "mosquitto"))) + +(define (mosquitto-accounts config) + (match-record config <mosquitto-configuration> + (user group) + (filter identity + (list + (and (equal? group "mosquitto") + (user-group + (name "mosquitto") + (system? #t))) + (and (equal? user "mosquitto") + (user-account + (name "mosquitto") + (group group) + (system? #t) + (comment "bzzz") + (home-directory "/var/empty") + (shell (file-append shadow "/sbin/nologin")))))))) + +(define (mosquitto-shepherd-service config) + (match-record config <mosquitto-configuration> + (package config-file user group) + (list (shepherd-service + (documentation "Run the Mosquitto MQTT broker.") + (provision '(mosquitto)) + (requirement '(networking syslogd user-processes)) + (start #~(make-forkexec-constructor + (list #$(file-append package "/sbin/mosquitto") + #$@(if config-file + (list "-c" config-file) + '())) + #:user #$user + #:group #$group)) + (stop #~(make-kill-destructor)))))) + +(define mosquitto-service-type + (service-type + (description "Run the Mosquitto MQTT broker.") + (name 'mosquitto) + (extensions + (list (service-extension account-service-type mosquitto-accounts) + (service-extension shepherd-root-service-type mosquitto-shepherd= -service))) + (default-value (mosquitto-configuration)))) base-commit: 831b94a1efcea8f793afc949b5123a6235c9bb1a --=20 2.47.1 --=-=-=--
GNU bug tracking system
Copyright (C) 1999 Darren O. Benham,
1997 nCipher Corporation Ltd,
1994-97 Ian Jackson.