From unknown Tue Jun 17 22:25:53 2025 X-Loop: help-debbugs@gnu.org Subject: [bug#33714] [PATCH] services: Add quassel. Resent-From: Efraim Flashner Original-Sender: "Debbugs-submit" Resent-CC: guix-patches@gnu.org Resent-Date: Wed, 12 Dec 2018 08:48:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: report 33714 X-GNU-PR-Package: guix-patches X-GNU-PR-Keywords: patch To: 33714@debbugs.gnu.org Cc: Efraim Flashner X-Debbugs-Original-To: guix-patches@gnu.org Received: via spool by submit@debbugs.gnu.org id=B.154460447518778 (code B ref -1); Wed, 12 Dec 2018 08:48:02 +0000 Received: (at submit) by debbugs.gnu.org; 12 Dec 2018 08:47:55 +0000 Received: from localhost ([127.0.0.1]:44499 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1gX0BN-0004sk-4D for submit@debbugs.gnu.org; Wed, 12 Dec 2018 03:47:53 -0500 Received: from eggs.gnu.org ([208.118.235.92]:40877) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1gX0BL-0004sX-LO for submit@debbugs.gnu.org; Wed, 12 Dec 2018 03:47:52 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1gX0BF-0002PY-68 for submit@debbugs.gnu.org; Wed, 12 Dec 2018 03:47:46 -0500 X-Spam-Checker-Version: SpamAssassin 3.3.2 (2011-06-06) on eggs.gnu.org X-Spam-Level: X-Spam-Status: No, score=0.8 required=5.0 tests=BAYES_50 autolearn=disabled version=3.3.2 Received: from lists.gnu.org ([2001:4830:134:3::11]:46303) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1gX0BF-0002PU-2N for submit@debbugs.gnu.org; Wed, 12 Dec 2018 03:47:45 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:50472) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gX0BD-0005jH-Jn for guix-patches@gnu.org; Wed, 12 Dec 2018 03:47:44 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1gX0B9-0002NE-Ir for guix-patches@gnu.org; Wed, 12 Dec 2018 03:47:43 -0500 Received: from flashner.co.il ([178.62.234.194]:37674) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gX0B9-0002MY-7z for guix-patches@gnu.org; Wed, 12 Dec 2018 03:47:39 -0500 Received: from localhost (unknown [5.102.239.133]) by flashner.co.il (Postfix) with ESMTPSA id 53C21400B5; Wed, 12 Dec 2018 08:47:37 +0000 (UTC) From: Efraim Flashner Date: Wed, 12 Dec 2018 10:47:28 +0200 Message-Id: <20181212084728.30089-1-efraim@flashner.co.il> X-Mailer: git-send-email 2.20.0 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6.x X-Received-From: 2001:4830:134:3::11 X-Spam-Score: -4.0 (----) 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: -5.0 (-----) * gnu/services/messaging.scm (): New record type. (%quassel-account, %quassel-activation): New procedures. (quassel-service-type): New variable. * gnu/tests/messaging.scm (%test-quassel): New variable. (run-quassel-test): New procedure. * doc/guix.texi (Messaging): Document quassel service. --- doc/guix.texi | 31 +++++++++++++ gnu/services/messaging.scm | 90 +++++++++++++++++++++++++++++++++++++- gnu/tests/messaging.scm | 54 ++++++++++++++++++++++- 3 files changed, 173 insertions(+), 2 deletions(-) diff --git a/doc/guix.texi b/doc/guix.texi index 20b5013fd..af78d9e46 100644 --- a/doc/guix.texi +++ b/doc/guix.texi @@ -16270,6 +16270,37 @@ Configuration snippet added as-is to the BitlBee= configuration file. @end table @end deftp =20 +@subsubheading Quassel Service + +@cindex IRC (Internet Relay Chat) +@url{https://quassel-irc.org/,Quassel} is a distributed IRC client, +meaning that one or more clients can attach to and detach from the +central core. + +@defvr {Scheme Variable} quassel-service-type +This is the service type for the @url{https://quassel-irc.org/,Quassel} +IRC backend daemon. Its value is a @code{quassel-configuration} +(see below). +@end defvr + +@deftp {Data Type} quassel-configuration +This is the configuration for Quassel, with the following fields: + +@table @asis +@item @code{quassel} (default: @code{quassel}) +The Quassel package to use. + +@item @code{interface} (default: @code{"::,0.0.0.0"}) +@item @code{port} (default: @code{4242}) +Listen on the network interface(s) corresponding to the IPv4 or IPv6 +interfaces specified in the comma delimited @var{interface}, on +@var{port}. + +@item @code{loglevel} (default: @code{"Info"}) +The level of logging desired. Accepted values are Debug, Info, Warning +and Error. +@end table +@end deftp =20 @node Telephony Services @subsubsection Telephony Services diff --git a/gnu/services/messaging.scm b/gnu/services/messaging.scm index 110800641..92f86a1b8 100644 --- a/gnu/services/messaging.scm +++ b/gnu/services/messaging.scm @@ -22,6 +22,8 @@ (define-module (gnu services messaging) #:use-module (gnu packages messaging) #:use-module (gnu packages admin) + #:use-module (gnu packages irc) + #:use-module (gnu packages tls) #:use-module (gnu services) #:use-module (gnu services shepherd) #:use-module (gnu services configuration) @@ -50,7 +52,10 @@ bitlbee-configuration bitlbee-configuration? bitlbee-service - bitlbee-service-type)) + bitlbee-service-type + + quassel-configuration + quassel-service-type)) =20 ;;; Commentary: ;;; @@ -895,3 +900,86 @@ configuration file." (bitlbee bitlbee) (interface interface) (port port) (extra-settings extra-settings)))) + +=0C +;;; +;;; Quassel. +;;; + +(define-record-type* + quassel-configuration make-quassel-configuration + quassel-configuration? + (quassel quassel-configuration-quassel + (default quassel)) + (interface quassel-configuration-interface + (default "::,0.0.0.0")) + (port quassel-configuration-port + (default 4242)) + (loglevel quassel-configuration-loglevel + (default "Info"))) + +(define quassel-shepherd-service + (match-lambda + (($ quassel interface port loglevel) + (with-imported-modules (source-module-closure + '((gnu build shepherd) + (gnu system file-systems))) + (list (shepherd-service + (provision '(quassel)) + (requirement '(user-processes networking)) + (modules '((gnu build shepherd) + (gnu system file-systems))) + (start #~(make-forkexec-constructor/container + (list #$(file-append quassel "/bin/quasselcore= ") + "--configdir=3D/var/lib/quassel" + "--logfile=3D/var/log/quassel/core.log" + (string-append "--loglevel=3D" #$logleve= l) + (string-append "--port=3D" (number->stri= ng #$port)) + (string-append "--listen=3D" #$interface= )) + #:mappings (list (file-system-mapping + (source "/var/lib/quassel") + (target source) + (writable? #t)) + (file-system-mapping + (source "/var/log/quassel") + (target source) + (writable? #t))))) + (stop #~(make-kill-destructor)))))))) + +(define %quassel-account + (list (user-group (name "quassel") (system? #t)) + (user-account + (name "quasselcore") + (group "quassel") + (system? #t) + (comment "Quassel daemon user") + (home-directory "/var/lib/quassel") + (shell (file-append shadow "/sbin/nologin"))))) + +(define %quassel-activation + #~(begin + (use-modules (guix build utils)) + (mkdir-p "/var/lib/quassel") + (mkdir-p "/var/log/quassel") + (let ((cert "/var/lib/quassel/quasselCert.pem")) + (unless (file-exists? cert) + (invoke #$(file-append openssl "/bin/openssl") + "req" "-x509" "-nodes" "-batch" "-days" "680" "-newkey= " + "rsa" "-keyout" cert "-out" cert))))) + +(define quassel-service-type + (service-type (name 'quassel) + (extensions + (list (service-extension shepherd-root-service-type + quassel-shepherd-service) + (service-extension profile-service-type + (compose list quassel-configu= ration-quassel)) + (service-extension account-service-type + (const %quassel-account)) + (service-extension activation-service-type + (const %quassel-activation)))= ) + (default-value (quassel-configuration)) + (description + "Run @url{https://quassel-irc.org/,quasselcore}, the ba= ckend +for the distributed IRC client quassel, which allows you to connect from +multiple machines simultaneously."))) diff --git a/gnu/tests/messaging.scm b/gnu/tests/messaging.scm index 36afb987a..176e3d08c 100644 --- a/gnu/tests/messaging.scm +++ b/gnu/tests/messaging.scm @@ -1,6 +1,7 @@ ;;; GNU Guix --- Functional package management for GNU ;;; Copyright =C2=A9 2017, 2018 Cl=C3=A9ment Lassieur ;;; Copyright =C2=A9 2017, 2018 Ludovic Court=C3=A8s +;;; Copyright =C2=A9 2018 Efraim Flashner ;;; ;;; This file is part of GNU Guix. ;;; @@ -29,7 +30,8 @@ #:use-module (guix store) #:use-module (guix modules) #:export (%test-prosody - %test-bitlbee)) + %test-bitlbee + %test-quassel)) =20 (define (run-xmpp-test name xmpp-service pid-file create-account) "Run a test of an OS running XMPP-SERVICE, which writes its PID to PID= -FILE." @@ -239,3 +241,53 @@ (name "bitlbee") (description "Connect to a BitlBee IRC server.") (value (run-bitlbee-test)))) + +(define (run-quassel-test) + (define os + (marionette-operating-system + (simple-operating-system (service dhcp-client-service-type) + (service quassel-service-type)) + #:imported-modules (source-module-closure + '((gnu services herd))))) + + (define vm + (virtual-machine + (operating-system os) + (port-forwardings `((4242 . 4242))))) + + (define test + (with-imported-modules '((gnu build marionette)) + #~(begin + (use-modules (srfi srfi-64) + (gnu build marionette)) + + (define marionette + (make-marionette (list #$vm))) + + (mkdir #$output) + (chdir #$output) + + (test-begin "quassel") + + (test-assert "service started" + (marionette-eval + '(begin + (use-modules (gnu services herd)) + (start-service 'quassel)) + marionette)) + + (test-assert "certificate file" + (marionette-eval + '(file-exists? "/var/lib/quassel/quasselCert.pem") + marionette)) + + (test-end) + (exit (=3D (test-runner-fail-count (test-runner-current)) 0)))= )) + + (gexp->derivation "quassel-test" test)) + +(define %test-quassel + (system-test + (name "quassel") + (description "Connect to a quassel IRC server.") + (value (run-quassel-test)))) --=20 2.20.0 From unknown Tue Jun 17 22:25:53 2025 MIME-Version: 1.0 X-Mailer: MIME-tools 5.505 (Entity 5.505) X-Loop: help-debbugs@gnu.org From: help-debbugs@gnu.org (GNU bug Tracking System) To: Efraim Flashner Subject: bug#33714: closed (Re: [PATCH] services: Add quassel.) Message-ID: References: <20181224093210.GH2581@macbook41> <20181212084728.30089-1-efraim@flashner.co.il> X-Gnu-PR-Message: they-closed 33714 X-Gnu-PR-Package: guix-patches X-Gnu-PR-Keywords: patch Reply-To: 33714@debbugs.gnu.org Date: Mon, 24 Dec 2018 09:33:02 +0000 Content-Type: multipart/mixed; boundary="----------=_1545643982-6853-1" This is a multi-part message in MIME format... ------------=_1545643982-6853-1 Content-Disposition: inline Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" Your bug report #33714: [PATCH] services: Add quassel. which was filed against the guix-patches package, has been closed. The explanation is attached below, along with your original report. If you require more details, please reply to 33714@debbugs.gnu.org. --=20 33714: http://debbugs.gnu.org/cgi/bugreport.cgi?bug=3D33714 GNU Bug Tracking System Contact help-debbugs@gnu.org with problems ------------=_1545643982-6853-1 Content-Type: message/rfc822 Content-Disposition: inline Content-Transfer-Encoding: 7bit Received: (at 33714-done) by debbugs.gnu.org; 24 Dec 2018 09:32:19 +0000 Received: from localhost ([127.0.0.1]:34298 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1gbMax-0001lV-0M for submit@debbugs.gnu.org; Mon, 24 Dec 2018 04:32:19 -0500 Received: from flashner.co.il ([178.62.234.194]:40212) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1gbMav-0001lF-Al for 33714-done@debbugs.gnu.org; Mon, 24 Dec 2018 04:32:17 -0500 Received: from localhost (unknown [141.226.9.73]) by flashner.co.il (Postfix) with ESMTPSA id 8946F402D5 for <33714-done@debbugs.gnu.org>; Mon, 24 Dec 2018 09:32:11 +0000 (UTC) Date: Mon, 24 Dec 2018 11:32:10 +0200 From: Efraim Flashner To: 33714-done@debbugs.gnu.org Subject: Re: [PATCH] services: Add quassel. Message-ID: <20181224093210.GH2581@macbook41> References: <20181212084728.30089-1-efraim@flashner.co.il> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha512; protocol="application/pgp-signature"; boundary="MzdA25v054BPvyZa" Content-Disposition: inline In-Reply-To: <20181212084728.30089-1-efraim@flashner.co.il> User-Agent: Mutt/1.11.0 (2018-11-25) X-Spam-Score: -0.0 (/) X-Debbugs-Envelope-To: 33714-done 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 (-) --MzdA25v054BPvyZa Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: quoted-printable Patch pushed as dcad57d5fca43a111e1b314264171c80d4d9a75b --=20 Efraim Flashner =D7=90=D7=A4=D7=A8=D7=99=D7=9D = =D7=A4=D7=9C=D7=A9=D7=A0=D7=A8 GPG key =3D A28B F40C 3E55 1372 662D 14F7 41AA E7DC CA3D 8351 Confidentiality cannot be guaranteed on emails sent or received unencrypted --MzdA25v054BPvyZa Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iQIzBAABCgAdFiEEoov0DD5VE3JmLRT3Qarn3Mo9g1EFAlwgp5UACgkQQarn3Mo9 g1EitA//QZcLNUORHLZ+wIXI5UFqNpxYHUR0bWd1GGsZ+ujtqzJsWbz2zaHP1wM2 2bGMEJOFfDXB6JgL5X2U/AfxoVDCiMG3X+BxS+/nEycnADcFKdwTHh6lAsaal3H0 dBQhMT+l4PjuTwyRq84OTA9akxsgdkJE/r780G5SAh/wvcFIoWV9YiMJJUMuxrU4 sFkDC0gyaxdnhvsTF7NKeeLpW9A66srCsY0/s+B0wMbEF7TyMgCvcUqnW1tDPMyj fsr+Apf5h6aFSXWixKsI05YNxYH7qHTCqCD1O53drGxpBd0Ob4uK1wiT09ut3veh MvSJyaSrFgoby6GoDa+U0pVjPtM0NeZfJ018f0MB8P+eW7MyMS0BfDOfg/SUL6qB 6SFf+eHh2Pq109QWJWq2AR33KQimt/fwmzFVnbo2Coi5ObsNNjscNRj92p2dNjJY m9YXWEDPav749mpxrMbzHMelpB5Cp6R/vOUrX4QyPP0kMd82C9ty1GWxC4kKe8qz RHmyD1OEkEuliR8+6DckcdEn9+NvK3nBPgayvL3sLK4SXhUipnFsfLxOumm9Yh+M KY7KDmjrPAn/Q66f+32X5Qere71pxtqDYSE7SPkChjy7DDTnK+ZG4EPzWCoV6j7G X5DcgdyqSsAuvO/a1nJNBYWQy5uqv033Ld8qjcQ60hFE0ABLvd0= =yc2r -----END PGP SIGNATURE----- --MzdA25v054BPvyZa-- ------------=_1545643982-6853-1 Content-Type: message/rfc822 Content-Disposition: inline Content-Transfer-Encoding: 7bit Received: (at submit) by debbugs.gnu.org; 12 Dec 2018 08:47:55 +0000 Received: from localhost ([127.0.0.1]:44499 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1gX0BN-0004sk-4D for submit@debbugs.gnu.org; Wed, 12 Dec 2018 03:47:53 -0500 Received: from eggs.gnu.org ([208.118.235.92]:40877) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1gX0BL-0004sX-LO for submit@debbugs.gnu.org; Wed, 12 Dec 2018 03:47:52 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1gX0BF-0002PY-68 for submit@debbugs.gnu.org; Wed, 12 Dec 2018 03:47:46 -0500 X-Spam-Checker-Version: SpamAssassin 3.3.2 (2011-06-06) on eggs.gnu.org X-Spam-Level: X-Spam-Status: No, score=0.8 required=5.0 tests=BAYES_50 autolearn=disabled version=3.3.2 Received: from lists.gnu.org ([2001:4830:134:3::11]:46303) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1gX0BF-0002PU-2N for submit@debbugs.gnu.org; Wed, 12 Dec 2018 03:47:45 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:50472) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gX0BD-0005jH-Jn for guix-patches@gnu.org; Wed, 12 Dec 2018 03:47:44 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1gX0B9-0002NE-Ir for guix-patches@gnu.org; Wed, 12 Dec 2018 03:47:43 -0500 Received: from flashner.co.il ([178.62.234.194]:37674) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gX0B9-0002MY-7z for guix-patches@gnu.org; Wed, 12 Dec 2018 03:47:39 -0500 Received: from localhost (unknown [5.102.239.133]) by flashner.co.il (Postfix) with ESMTPSA id 53C21400B5; Wed, 12 Dec 2018 08:47:37 +0000 (UTC) From: Efraim Flashner To: guix-patches@gnu.org Subject: [PATCH] services: Add quassel. Date: Wed, 12 Dec 2018 10:47:28 +0200 Message-Id: <20181212084728.30089-1-efraim@flashner.co.il> X-Mailer: git-send-email 2.20.0 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6.x X-Received-From: 2001:4830:134:3::11 X-Spam-Score: -4.0 (----) X-Debbugs-Envelope-To: submit Cc: Efraim Flashner 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: -5.0 (-----) * gnu/services/messaging.scm (): New record type. (%quassel-account, %quassel-activation): New procedures. (quassel-service-type): New variable. * gnu/tests/messaging.scm (%test-quassel): New variable. (run-quassel-test): New procedure. * doc/guix.texi (Messaging): Document quassel service. --- doc/guix.texi | 31 +++++++++++++ gnu/services/messaging.scm | 90 +++++++++++++++++++++++++++++++++++++- gnu/tests/messaging.scm | 54 ++++++++++++++++++++++- 3 files changed, 173 insertions(+), 2 deletions(-) diff --git a/doc/guix.texi b/doc/guix.texi index 20b5013fd..af78d9e46 100644 --- a/doc/guix.texi +++ b/doc/guix.texi @@ -16270,6 +16270,37 @@ Configuration snippet added as-is to the BitlBee= configuration file. @end table @end deftp =20 +@subsubheading Quassel Service + +@cindex IRC (Internet Relay Chat) +@url{https://quassel-irc.org/,Quassel} is a distributed IRC client, +meaning that one or more clients can attach to and detach from the +central core. + +@defvr {Scheme Variable} quassel-service-type +This is the service type for the @url{https://quassel-irc.org/,Quassel} +IRC backend daemon. Its value is a @code{quassel-configuration} +(see below). +@end defvr + +@deftp {Data Type} quassel-configuration +This is the configuration for Quassel, with the following fields: + +@table @asis +@item @code{quassel} (default: @code{quassel}) +The Quassel package to use. + +@item @code{interface} (default: @code{"::,0.0.0.0"}) +@item @code{port} (default: @code{4242}) +Listen on the network interface(s) corresponding to the IPv4 or IPv6 +interfaces specified in the comma delimited @var{interface}, on +@var{port}. + +@item @code{loglevel} (default: @code{"Info"}) +The level of logging desired. Accepted values are Debug, Info, Warning +and Error. +@end table +@end deftp =20 @node Telephony Services @subsubsection Telephony Services diff --git a/gnu/services/messaging.scm b/gnu/services/messaging.scm index 110800641..92f86a1b8 100644 --- a/gnu/services/messaging.scm +++ b/gnu/services/messaging.scm @@ -22,6 +22,8 @@ (define-module (gnu services messaging) #:use-module (gnu packages messaging) #:use-module (gnu packages admin) + #:use-module (gnu packages irc) + #:use-module (gnu packages tls) #:use-module (gnu services) #:use-module (gnu services shepherd) #:use-module (gnu services configuration) @@ -50,7 +52,10 @@ bitlbee-configuration bitlbee-configuration? bitlbee-service - bitlbee-service-type)) + bitlbee-service-type + + quassel-configuration + quassel-service-type)) =20 ;;; Commentary: ;;; @@ -895,3 +900,86 @@ configuration file." (bitlbee bitlbee) (interface interface) (port port) (extra-settings extra-settings)))) + +=0C +;;; +;;; Quassel. +;;; + +(define-record-type* + quassel-configuration make-quassel-configuration + quassel-configuration? + (quassel quassel-configuration-quassel + (default quassel)) + (interface quassel-configuration-interface + (default "::,0.0.0.0")) + (port quassel-configuration-port + (default 4242)) + (loglevel quassel-configuration-loglevel + (default "Info"))) + +(define quassel-shepherd-service + (match-lambda + (($ quassel interface port loglevel) + (with-imported-modules (source-module-closure + '((gnu build shepherd) + (gnu system file-systems))) + (list (shepherd-service + (provision '(quassel)) + (requirement '(user-processes networking)) + (modules '((gnu build shepherd) + (gnu system file-systems))) + (start #~(make-forkexec-constructor/container + (list #$(file-append quassel "/bin/quasselcore= ") + "--configdir=3D/var/lib/quassel" + "--logfile=3D/var/log/quassel/core.log" + (string-append "--loglevel=3D" #$logleve= l) + (string-append "--port=3D" (number->stri= ng #$port)) + (string-append "--listen=3D" #$interface= )) + #:mappings (list (file-system-mapping + (source "/var/lib/quassel") + (target source) + (writable? #t)) + (file-system-mapping + (source "/var/log/quassel") + (target source) + (writable? #t))))) + (stop #~(make-kill-destructor)))))))) + +(define %quassel-account + (list (user-group (name "quassel") (system? #t)) + (user-account + (name "quasselcore") + (group "quassel") + (system? #t) + (comment "Quassel daemon user") + (home-directory "/var/lib/quassel") + (shell (file-append shadow "/sbin/nologin"))))) + +(define %quassel-activation + #~(begin + (use-modules (guix build utils)) + (mkdir-p "/var/lib/quassel") + (mkdir-p "/var/log/quassel") + (let ((cert "/var/lib/quassel/quasselCert.pem")) + (unless (file-exists? cert) + (invoke #$(file-append openssl "/bin/openssl") + "req" "-x509" "-nodes" "-batch" "-days" "680" "-newkey= " + "rsa" "-keyout" cert "-out" cert))))) + +(define quassel-service-type + (service-type (name 'quassel) + (extensions + (list (service-extension shepherd-root-service-type + quassel-shepherd-service) + (service-extension profile-service-type + (compose list quassel-configu= ration-quassel)) + (service-extension account-service-type + (const %quassel-account)) + (service-extension activation-service-type + (const %quassel-activation)))= ) + (default-value (quassel-configuration)) + (description + "Run @url{https://quassel-irc.org/,quasselcore}, the ba= ckend +for the distributed IRC client quassel, which allows you to connect from +multiple machines simultaneously."))) diff --git a/gnu/tests/messaging.scm b/gnu/tests/messaging.scm index 36afb987a..176e3d08c 100644 --- a/gnu/tests/messaging.scm +++ b/gnu/tests/messaging.scm @@ -1,6 +1,7 @@ ;;; GNU Guix --- Functional package management for GNU ;;; Copyright =C2=A9 2017, 2018 Cl=C3=A9ment Lassieur ;;; Copyright =C2=A9 2017, 2018 Ludovic Court=C3=A8s +;;; Copyright =C2=A9 2018 Efraim Flashner ;;; ;;; This file is part of GNU Guix. ;;; @@ -29,7 +30,8 @@ #:use-module (guix store) #:use-module (guix modules) #:export (%test-prosody - %test-bitlbee)) + %test-bitlbee + %test-quassel)) =20 (define (run-xmpp-test name xmpp-service pid-file create-account) "Run a test of an OS running XMPP-SERVICE, which writes its PID to PID= -FILE." @@ -239,3 +241,53 @@ (name "bitlbee") (description "Connect to a BitlBee IRC server.") (value (run-bitlbee-test)))) + +(define (run-quassel-test) + (define os + (marionette-operating-system + (simple-operating-system (service dhcp-client-service-type) + (service quassel-service-type)) + #:imported-modules (source-module-closure + '((gnu services herd))))) + + (define vm + (virtual-machine + (operating-system os) + (port-forwardings `((4242 . 4242))))) + + (define test + (with-imported-modules '((gnu build marionette)) + #~(begin + (use-modules (srfi srfi-64) + (gnu build marionette)) + + (define marionette + (make-marionette (list #$vm))) + + (mkdir #$output) + (chdir #$output) + + (test-begin "quassel") + + (test-assert "service started" + (marionette-eval + '(begin + (use-modules (gnu services herd)) + (start-service 'quassel)) + marionette)) + + (test-assert "certificate file" + (marionette-eval + '(file-exists? "/var/lib/quassel/quasselCert.pem") + marionette)) + + (test-end) + (exit (=3D (test-runner-fail-count (test-runner-current)) 0)))= )) + + (gexp->derivation "quassel-test" test)) + +(define %test-quassel + (system-test + (name "quassel") + (description "Connect to a quassel IRC server.") + (value (run-quassel-test)))) --=20 2.20.0 ------------=_1545643982-6853-1--