From patchwork Tue Mar 11 21:54:55 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Janneke Nieuwenhuizen X-Patchwork-Id: 40125 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 7685727BBE9; Tue, 11 Mar 2025 21:56:38 +0000 (GMT) X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on mira.cbaines.net X-Spam-Level: X-Spam-Status: No, score=-7.6 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,MAILING_LIST_MULTI,RCVD_IN_DNSWL_BLOCKED, RCVD_IN_VALIDITY_CERTIFIED,RCVD_IN_VALIDITY_RPBL,RCVD_IN_VALIDITY_SAFE, SPF_HELO_PASS,URIBL_BLOCKED autolearn=unavailable autolearn_force=no version=3.4.6 Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mira.cbaines.net (Postfix) with ESMTPS id D885B27BBE2 for ; Tue, 11 Mar 2025 21:56:36 +0000 (GMT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1ts7a2-0005Re-Rp; Tue, 11 Mar 2025 17:56:06 -0400 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 ) id 1ts7a0-0005Qi-EC for guix-patches@gnu.org; Tue, 11 Mar 2025 17:56:05 -0400 Received: from debbugs.gnu.org ([2001:470:142:5::43]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1ts7a0-0001YM-2N; Tue, 11 Mar 2025 17:56:04 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=debbugs.gnu.org; s=debbugs-gnu-org; h=MIME-Version:Date:From:To:Subject; bh=ctyaAHo2eM1h5eGpH8YM7seW/Oo17RSWz685P1EPAAA=; b=sjRhfEHRXwqO6ENjS5Bn3sbTAtF3ScxcDUahXTh9r3uzubML/P1nDA2r5ZxH9m+AC3wIE1+YClk822728yUhsMIU/3zfXAKkrkx+GSzmDD5H5qax+uZX0QdLc/Bf2ek2k95QTbcNU32tS7pUN1AgTU0BBwExEu3iC+c8ogjLKeGV85BLtQaVX89zYdxSBLkmkb+KV2CriAb8ISJHRLdq0x3m06k9p6hfgbP0yIC4jQ5a02dAvTBktXVdIHo9075aQKiFncXCC9VsFuHHDiEkfIq7A5+Zfwqq7jkAwsIipVIaqpHHauvtEKSYrQGD778Z2lcrmkl6It753/yugdfW9A==; Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1ts7Zx-0005TV-P1; Tue, 11 Mar 2025 17:56:01 -0400 X-Loop: help-debbugs@gnu.org Subject: [bug#76963] [PATCH] home: Add home-snuik-service. Resent-From: Janneke Nieuwenhuizen Original-Sender: "Debbugs-submit" Resent-CC: andrew@trop.in, janneke@gnu.org, ludo@gnu.org, maxim.cournoyer@gmail.com, tanguy@bioneland.org, guix-patches@gnu.org Resent-Date: Tue, 11 Mar 2025 21:56:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: report 76963 X-GNU-PR-Package: guix-patches X-GNU-PR-Keywords: patch To: 76963@debbugs.gnu.org Cc: Andrew Tropin , Janneke Nieuwenhuizen , Ludovic =?utf-8?q?Court=C3=A8s?= , Maxim Cournoyer , Tanguy Le Carrour X-Debbugs-Original-To: guix-patches@gnu.org X-Debbugs-Original-Xcc: Andrew Tropin , Janneke Nieuwenhuizen , Ludovic =?utf-8?q?Court=C3=A8s?= , Maxim Cournoyer , Tanguy Le Carrour Received: via spool by submit@debbugs.gnu.org id=B.174173011120976 (code B ref -1); Tue, 11 Mar 2025 21:56:01 +0000 Received: (at submit) by debbugs.gnu.org; 11 Mar 2025 21:55:11 +0000 Received: from localhost ([127.0.0.1]:46160 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1ts7Z8-0005Ry-QT for submit@debbugs.gnu.org; Tue, 11 Mar 2025 17:55:11 -0400 Received: from lists.gnu.org ([2001:470:142::17]:38140) by debbugs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.84_2) (envelope-from ) id 1ts7Z4-0005LL-Ly for submit@debbugs.gnu.org; Tue, 11 Mar 2025 17:55:07 -0400 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 ) id 1ts7Yy-0004de-6q for guix-patches@gnu.org; Tue, 11 Mar 2025 17:55:00 -0400 Received: from fencepost.gnu.org ([2001:470:142:3::e]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1ts7Yw-0001AM-Ie; Tue, 11 Mar 2025 17:54:58 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnu.org; s=fencepost-gnu-org; h=MIME-Version:Date:Subject:To:From:in-reply-to: references; bh=ctyaAHo2eM1h5eGpH8YM7seW/Oo17RSWz685P1EPAAA=; b=pbK62NnlsARkxV MlZFKMNZTatA8CtTHDLr4i6Rjns0aB/3dEeVWGJuOWQIcHsfznlZGhlCBVrL70fwz3LUOlHe+iFVk VwLLsUzN6Cc3O+xzTvM/L7Kk0tNOum9+7RI4/rJ7xx6o2lgjOed34LNx5eV0/D/iySYoX6mDORp31 zbCqQ6ij96g/7debWp6P4nXvOlY6UkUg2TvXx0PI//3S5x3yqkBeTtgv6oYaIeHbslv2tiURFhph2 kOWFF14hQUmX6Iwp4IONToDhbRHoYo/6SJTI3iIJjfq9Sb0ANk/3lUJg3afMKfxpeHvoOczHdTn5h /AXCsW0rEBY8HyodgOig==; From: Janneke Nieuwenhuizen Date: Tue, 11 Mar 2025 22:54:55 +0100 Message-ID: <7f43764f98a45b92cce1be2e7d352e3c791cebf8.1741729617.git.janneke@gnu.org> X-Mailer: git-send-email 2.47.1 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-bounces+patchwork=mira.cbaines.net@gnu.org X-getmail-retrieved-from-mailbox: Patches * gnu/home/services/messaging.scm (): New type. (home-snuik-services, home-snuik-service-type): New procedures. * doc/guix.texi (Messaging Home Services): Document it. Change-Id: I1e278e7d8ed04efcb1a2ce9e12e69cb6a31a9fa4 --- doc/guix.texi | 58 ++++++++++++++++++++++++- gnu/home/services/messaging.scm | 77 ++++++++++++++++++++++++++++++++- 2 files changed, 132 insertions(+), 3 deletions(-) base-commit: d685a45edf0f89e5876ffc9d880068d8610e5f8a diff --git a/doc/guix.texi b/doc/guix.texi index d109877a32..f35e156376 100644 --- a/doc/guix.texi +++ b/doc/guix.texi @@ -36,7 +36,7 @@ Copyright @copyright{} 2016, 2017, 2018, 2019, 2020, 2021, 2022, 2023 Efraim Flashner@* Copyright @copyright{} 2016 John Darrington@* Copyright @copyright{} 2016, 2017 Nikita Gillmann@* -Copyright @copyright{} 2016, 2017, 2018, 2019, 2020, 2021, 2022, 2023, 2024 Janneke Nieuwenhuizen@* +Copyright @copyright{} 2016, 2017, 2018, 2019, 2020, 2021, 2022, 2023, 2024, 2025 Janneke Nieuwenhuizen@* Copyright @copyright{} 2016, 2017, 2018, 2019, 2020, 2021 Julien Lepiller@* Copyright @copyright{} 2016 Alex ter Weele@* Copyright @copyright{} 2016, 2017, 2018, 2019, 2020, 2021 Christopher Baines@* @@ -49714,6 +49714,62 @@ Messaging Home Services @end table @end deftp +@cindex snuik +The @uref{https://gitlab.com/janneke/snuik, Snuik IRC bot} can be run as +a daemon to aid talking to users that are currently off-line. With the +@code{(gnu home services messaging)} service, you can configure Snuik to +run upon login. + +Here is an example of a service and its configuration that you could add +to the @code{services} field of your @code{home-environment}: + +@lisp +(service home-snuik-service-type + (home-snuik-configuration + (password-file ".password.snuik") + (channels '("#bootstrappable" + "#dezyne" + "#guix-risc-v" + "#lilypond")))) +@end lisp + +@defvar home-snuik-service-type +This is the type of the Snuik home service, whose value is a +@code{home-snuik-configuration} object. +@end defvar + +@deftp {Data Type} home-snuik-configuration +Available @code{home-snuik-configuration} fields are: + +@table @asis +@item @code{snuik} (default: @code{snuik}) (type: file-like) +The Snuik package to use. + +@item @code{server} (default: @code{"irc.libera.chat"}) +The IRC server to connect to. + +@item @code{port} (default: @code{6665}) +Port number used by the IRC server. + +@item @code{nick} (default: @code{"snuik"}) +The nickname for snuik to use. + +@item @code{password} (default: @code{#f}) +The password to use when logging in. + +@item @code{password-file} (default: @code{".password.}) +The file to read the password from to use when logging in. + +@item @code{channels} (default: @code{'("##botchat")}) +The channels for snuik to join, a list of strings. + +@item @code{extra-options} (default: @code{'()}) +Extra options will be passed to @command{snuik}, please run +@command{snuik --help } for more information. + +@end table +@end deftp + @node Media Home Services @subsection Media Home Services diff --git a/gnu/home/services/messaging.scm b/gnu/home/services/messaging.scm index bd2f1bb23f..be2a3436ba 100644 --- a/gnu/home/services/messaging.scm +++ b/gnu/home/services/messaging.scm @@ -1,5 +1,5 @@ ;;; GNU Guix --- Functional package management for GNU -;;; Copyright © 2023 Janneke Nieuwenhuizen +;;; Copyright © 2023, 2025 Janneke Nieuwenhuizen ;;; ;;; This file is part of GNU Guix. ;;; @@ -20,12 +20,15 @@ (define-module (gnu home services messaging) #:use-module (srfi srfi-26) #:use-module (gnu home services) #:use-module (gnu home services shepherd) + #:use-module (gnu packages irc) #:use-module (gnu packages messaging) #:use-module (gnu services configuration) #:use-module (gnu services shepherd) #:use-module (guix records) #:use-module (guix gexp) - #:export (home-znc-configuration + #:export (home-snuik-configuration + home-snuik-service-type + home-znc-configuration home-znc-service-type)) ;;; @@ -64,3 +67,73 @@ (define home-znc-service-type (description "Install and configure @command{znc}, an @acronym{IRC, Internet Relay Chat} bouncer, as a Shepherd service."))) + + +;;; +;;; Snuik. +;;; +(define-record-type* + home-snuik-configuration make-home-snuik-configuration + home-snuik-configuration? + (snuik home-snuik-snuik ;file-like + (default snuik)) + (server home-snuik-server ;string + (default #f)) + (port home-snuik-port ;integer + (default #f)) + (nick home-snuik-nick ;string + (default #f)) + (password home-snuik-password ;string + (default #f)) + (password-file home-snuik-password-file ;string + (default #f)) + (channels home-snuik-channels ;list of string + (default '())) + (extra-options home-snuik-extra-options ;list of string + (default '()))) + +(define (home-snuik-services config) + "Return a for snuik with CONFIG." + (match-record config + + (snuik server port nick password password-file channels extra-options) + (let* ((snuik (file-append snuik "/bin/snuik")) + (command #~'(#$snuik + #$@(if server + #~("--server" #$server) + #~()) + #$@(if port + #~("--port" (number->string port)) + #~()) + #$@(if nick + #~("--nick" nick) + #~()) + #$@(if password + #~("--password" password) + #~()) + #$@(if password-file + #~("--password-file" password-file) + #~()) + #$@(if (pair? channels) + #~("--channels" (string-join channels ",")) + #~()) + #$@extra-options)) + (log-file #~(string-append %user-log-dir "/snuik.log"))) + (list (shepherd-service + (documentation "Run the snuik IRC bot.") + (provision '(snuik)) + (modules '((shepherd support))) ;for '%user-log-dir' + (start #~(make-forkexec-constructor #$command + #:log-file #$log-file)) + (stop #~(make-kill-destructor))))))) + +(define home-snuik-service-type + (service-type + (name 'home-snuik) + (default-value (home-snuik-configuration)) + (extensions + (list (service-extension home-shepherd-service-type + home-snuik-services))) + (description + "Install and configure the Snuik IRC bot so that it runs as a Shepherd +service.")))