From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp10.migadu.com ([2001:41d0:2:bcc0::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by ms5.migadu.com with LMTPS id oJBXIlZSRGN3CQAAbAwnHQ (envelope-from ) for ; Mon, 10 Oct 2022 19:11:50 +0200 Received: from aspmx1.migadu.com ([2001:41d0:2:bcc0::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp10.migadu.com with LMTPS id GPraIVZSRGM9eAEAG6o9tA (envelope-from ) for ; Mon, 10 Oct 2022 19:11:50 +0200 Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by aspmx1.migadu.com (Postfix) with ESMTPS id 185FB3BD76 for ; Mon, 10 Oct 2022 19:11:50 +0200 (CEST) Received: from localhost ([::1]:43748 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1ohwJh-0000A3-4f for larch@yhetil.org; Mon, 10 Oct 2022 13:11:49 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:42342) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1ohwD9-0004ui-A6 for guix-patches@gnu.org; Mon, 10 Oct 2022 13:05:03 -0400 Received: from debbugs.gnu.org ([209.51.188.43]:50657) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1ohwD8-0000lN-Vl for guix-patches@gnu.org; Mon, 10 Oct 2022 13:05:03 -0400 Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1ohwD8-0002KG-R5 for guix-patches@gnu.org; Mon, 10 Oct 2022 13:05:02 -0400 X-Loop: help-debbugs@gnu.org Subject: [bug#56961] [PATCH v2 4/4] gnu: Add home-senpai-service-type. Resent-From: "(" Original-Sender: "Debbugs-submit" Resent-CC: guix-patches@gnu.org Resent-Date: Mon, 10 Oct 2022 17:05:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 56961 X-GNU-PR-Package: guix-patches X-GNU-PR-Keywords: patch To: 56961@debbugs.gnu.org Cc: "\(" Received: via spool by 56961-submit@debbugs.gnu.org id=B56961.16654214628863 (code B ref 56961); Mon, 10 Oct 2022 17:05:02 +0000 Received: (at 56961) by debbugs.gnu.org; 10 Oct 2022 17:04:22 +0000 Received: from localhost ([127.0.0.1]:49732 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1ohwCR-0002Ip-IN for submit@debbugs.gnu.org; Mon, 10 Oct 2022 13:04:22 -0400 Received: from knopi.disroot.org ([178.21.23.139]:46752) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1ohwCL-0002IF-1V for 56961@debbugs.gnu.org; Mon, 10 Oct 2022 13:04:16 -0400 Received: from localhost (localhost [127.0.0.1]) by disroot.org (Postfix) with ESMTP id 5EEBA4CAAD; Mon, 10 Oct 2022 19:04:12 +0200 (CEST) X-Virus-Scanned: SPAM Filter at disroot.org Received: from knopi.disroot.org ([127.0.0.1]) by localhost (disroot.org [127.0.0.1]) (amavisd-new, port 10024) with UTF8SMTP id QGhqWKqNRKFq; Mon, 10 Oct 2022 19:04:10 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=disroot.org; s=mail; t=1665421035; bh=2SZA+UBkDBm4Fu49T/NjvfWFoKihiOLVFz2uJ45sYk8=; h=From:To:Cc:Subject:Date:In-Reply-To:References; b=bET6Bg/l2UpG+oDvWUvF++CYf4lGfCLBZi2UyY6/135vYDK014sx1jgaBYvGvSWNB tjch9ujPlZ72WblkxrSES38Ngc3pRGBO/gQtBgmKiu7NPu/24vdrArHa6rIjmHC4ji Rq6le4JW0b+pIpk/mzB4EytO8jaqyciYcZy5qgiQYpmkYZoUX75ZaEiBaD6N3LDlx0 8uHfKKpMJNlEzzWKwG1IUb9kvvzkGyCyF2g3MCDsYZhNkRdwgwzWJZzbMCZaZsj6uo U1cgMbThmgm5cVm/sD9x64+jcOY2VYbw8SPoUqkE+l18seSRb3FT26u1T0kF3z7S+I 077/VAhBxiq/Q== Date: Mon, 10 Oct 2022 17:57:09 +0100 Message-Id: <20221010165709.22638-4-paren@disroot.org> In-Reply-To: <20221010165709.22638-1-paren@disroot.org> References: <20221010165709.22638-1-paren@disroot.org> Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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+larch=yhetil.org@gnu.org Sender: "Guix-patches" Reply-to: "\(" X-ACL-Warn: , "\( via Guix-patches" From: "\( via Guix-patches" via X-Migadu-Flow: FLOW_IN X-Migadu-Country: US ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=yhetil.org; s=key1; t=1665421910; h=from:from:sender:sender:reply-to:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding:resent-cc: resent-from:resent-sender:resent-message-id:in-reply-to:in-reply-to: references:references:list-id:list-help:list-unsubscribe: list-subscribe:list-post:dkim-signature; bh=oHC4GRwRQnUcT+oTOFOt9t1pELbf47HudJQWkCN2wek=; b=uk/qdpne4v6KpltmQGVHP3GOzwlyiMJxp/YJ7DgEqiMD7qBTeKiYa+tXsldbbP6hVChJ44 0WAcH+Lr2Du9DGxV3Q+yQTIr5AtK+w9Seo/OZHfKSNUAO4XvjeG56bImRqRbzN0Et9UzsO NKk/frTA/utqSYasork6XjtUwcD2nrpt+3dGiuDcASTaiHn3miZmQaweaBCmyh+r/6O/Ye eUAjJArXhnUpUuzEkHWbVHSkwliJhlQYI+1h0DZwpzTSeShXTEinWYZU+41GQkooKDPD1A /7DajKYD/UHCF0jLwDGGtf2bqsL9rNcB+QbhbJukJr5fNgGkN4pAqrA8i3MItA== ARC-Seal: i=1; s=key1; d=yhetil.org; t=1665421910; a=rsa-sha256; cv=none; b=OkBEZ2Qb9iJuCKEM3sNhWrPH+1gIOELgnWsLnAMTeoxtTy4Wpte7R10SxtQEzrtCfB1j6n 3eZ5IqmIOBKCqV6Nz2oaGMGK6WsxyFvbw4Nl7DtV3xkqgYa8jO+zcudrO11+8veeSgQxxP QhESpfX/CpMNdkaB3FG68YIEEhNig9K7dejow+YUmFByfRkT77w7NHbQab9f+6QEmWZTtj kMayeI4d+7jrRDvh6a35XL/GFHPNP9UuM/ksWGcZsOT9qZAo6nkha1ZAPd7YK5M3fIUUQC U2Wp3fl+d9LT8d1gHSvLauYv7Zt8EDy/TNtaeVfpUfSL0U09JBlkyeNWIdaxXA== ARC-Authentication-Results: i=1; aspmx1.migadu.com; dkim=fail ("headers rsa verify failed") header.d=disroot.org header.s=mail header.b="bET6Bg/l"; dmarc=pass (policy=none) header.from=gnu.org; spf=pass (aspmx1.migadu.com: domain of "guix-patches-bounces+larch=yhetil.org@gnu.org" designates 209.51.188.17 as permitted sender) smtp.mailfrom="guix-patches-bounces+larch=yhetil.org@gnu.org" X-Migadu-Spam-Score: -2.89 Authentication-Results: aspmx1.migadu.com; dkim=fail ("headers rsa verify failed") header.d=disroot.org header.s=mail header.b="bET6Bg/l"; dmarc=pass (policy=none) header.from=gnu.org; spf=pass (aspmx1.migadu.com: domain of "guix-patches-bounces+larch=yhetil.org@gnu.org" designates 209.51.188.17 as permitted sender) smtp.mailfrom="guix-patches-bounces+larch=yhetil.org@gnu.org" X-Migadu-Queue-Id: 185FB3BD76 X-Spam-Score: -2.89 X-Migadu-Scanner: scn1.migadu.com X-TUID: zPy5ZZNOVSze * gnu/local.mk: Add gnu/home/services/irc.scm. * gnu/home/services/irc.scm (home-senpai-configuration): New record type. (home-senpai-service-type): New variable. * doc/guix.texi ("Home Configuration")["Home Services"]: Document them. --- doc/guix.texi | 87 +++++++++++++++++++++ gnu/home/services/irc.scm | 154 ++++++++++++++++++++++++++++++++++++++ gnu/local.mk | 1 + 3 files changed, 242 insertions(+) create mode 100644 gnu/home/services/irc.scm diff --git a/doc/guix.texi b/doc/guix.texi index 14592142dd..f62d84c6e9 100644 --- a/doc/guix.texi +++ b/doc/guix.texi @@ -40363,6 +40363,7 @@ services)}. * Essential Home Services:: Environment variables, packages, on-* scripts. * Shells: Shells Home Services. POSIX shells, Bash, Zsh. * Mcron: Mcron Home Service. Scheduled User's Job Execution. +* IRC: IRC Home Services. Services for Internet Relay Chat. * Power Management: Power Management Home Services. Services for battery power. * Shepherd: Shepherd Home Service. Managing User's Daemons. * SSH: Secure Shell. Setting up the secure shell client. @@ -40815,6 +40816,92 @@ specifications,, mcron, GNU@tie{}mcron}). @end table @end deftp +@node IRC Home Services +@subsection IRC Home Services + +@cindex irc +@cindex messaging +The @code{(gnu home services irc)} module provides home services for +Internet Relay Chat-related programs. + +@defvr {Scheme Variable} home-senpai-service-type +Service for configuration of @code{senpai}, a terminal-based IRC client +that works best with network bouncers such as @code{znc} and @code{soju}. +@end defvr + +@deftp {Data Type} home-senpai-configuration +Data type representing the configuration of the +@code{home-senpai-service-type}. + +@table @asis +@item @code{address} +The address of the IRC server to connect to. + +@item @code{nickname} +A string to use as the IRC nickname. + +@item @code{username} (default: @code{#f}) +A string to use as the IRC username. + +@item @code{realname} (default: @code{#f}) +A string to use as the IRC real name. + +@item @code{password} +Either a string to use as the IRC password, or a list of strings +and file-like objects representing a command line that prints the +password to standard output. + +@item @code{channels} (default: @code{#f}) +A list of channels to connect to by default. + +@item @code{highlight-words} (default: @code{#f}) +A list of words that, when said by another user, will cause you to +be ``highlighted'', as if you were mentioned. + +@item @code{highlight-beep?} (default: @code{#f}) +Whether to make a sound when you are ``highlighted''. + +@item @code{highlight-script} (default: @code{#f}) +A file-like object representing a shell script to be run when you +are ``highlighted''. State information is passed to the script via +the environment; see @command{man senpai.5} for the list of +variables passed to the script. + +@item @code{nicknames-width} (default: @code{14}) +The width of the pane containing the nicknames corresponding to +each message. + +@item @code{channels-width} (default: @code{16}) +The width of the pane containing the list of channels. + +@item @code{members-width} (default: @code{16}) +The width of the pane containing the list of channel members. + +@item @code{message-width} (default: @code{0}) +The width of the messages. + +@item @code{tls?} (default: @code{#t}) +Whether to enable TLS connection support. + +@item @code{typing-notify?} (default: @code{#t}) +Whether to send typing notifications to others. + +@item @code{mouse?} (default: @code{#t}) +Whether to enable mouse interaction. + +@item @code{prompt-color} (default: @code{-1}) +The foreground colour (either an ANSI colour code number or a +hexadecimal colour string) to use for the ``>'' in the message +prompt. + +@item @code{unread-color} (default: @code{-1}) +The foreground colour to use for buffers with unread messages. + +@item @code{debug?} (default: @code{#f}) +Whether to print debugging information to the home message buffer. +@end table +@end deftp + @node Power Management Home Services @subsection Power Management Home Services diff --git a/gnu/home/services/irc.scm b/gnu/home/services/irc.scm new file mode 100644 index 0000000000..1097f9a5f0 --- /dev/null +++ b/gnu/home/services/irc.scm @@ -0,0 +1,154 @@ +;;; GNU Guix --- Functional package management for GNU +;;; Copyright © 2022 ( +;;; +;;; 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 home services irc) + #:use-module (gnu home services) + #:use-module (guix gexp) + #:use-module (guix packages) + #:use-module (guix records) + #:use-module (srfi srfi-1) + #:use-module (srfi srfi-26) + + #:export (home-senpai-service-type + home-senpai-configuration)) + +;;; Commentary: +;;; +;;; This module contains home services for Internet Relay Chat. +;;; +;;; Code: + + +;;; +;;; Senpai. +;;; + +(define-record-type* + home-senpai-configuration make-home-senpai-configuration + home-senpai-configuration? + (address home-senpai-address) ;string + (nickname home-senpai-nickname) ;string + (username home-senpai-username ;string | #f + (default #f)) + (realname home-senpai-realname ;string | #f + (default #f)) + (password home-senpai-password) ;string | file-like, list of string + (channels home-senpai-channels ;list of string | #f + (default #f)) + (highlight-words home-senpai-highlight-words ;list of string | #f + (default #f)) + (highlight-beep? home-senpai-highlight-beep? ;boolean + (default #f)) + (highlight-script home-senpai-highlight-script ;file-like | #f + (default #f)) + (nicknames-width home-senpai-nicknames-width ;integer + (default 14)) + (channels-width home-senpai-channels-width ;integer + (default 16)) + (members-width home-senpai-members-width ;integer + (default 16)) + (message-width home-senpai-message-width ;integer + (default 0)) + (tls? home-senpai-tls? ;boolean + (default #t)) + (typing-notify? home-senpai-typing-notify? ;boolean + (default #t)) + (mouse? home-senpai-mouse? ;boolean + (default #t)) + (prompt-color home-senpai-prompt-color ;integer | string + (default -1)) + (unread-color home-senpai-unread-color ;integer | string + (default -1)) + (debug? home-senpai-debug? ;boolean + (default #f))) + +(define (home-senpai-xdg-configuration-files config) + (define (string-field name field) + (let ((value (field config))) + (if value + (list name " \"" value "\"\n") + '()))) + + (define (string-list-field name field) + (let ((value (field config))) + (if value + (append (list name) + (concatenate (map (cute list " \"" <> "\"") value)) + (list "\n")) + '()))) + + (define (integer-field name field) + (let ((value (field config))) + (if value + (list name " " (number->string value) "\n") + '()))) + + (define (colour-field name field) + (let ((value (field config))) + (if (string? value) + (string-field name (compose (cute string-append "#" <>) + field)) + (integer-field name field)))) + + (define (boolean-field name field) + (let ((value (field config))) + (list name " " (if value "true" "false") "\n"))) + + (define (symbol-field name field) + (string-field name (compose symbol->string field))) + + (define* (record-field name #:rest fields) + (append (list name " {\n") + (concatenate fields) + (list "}\n"))) + + `(("senpai/sen.scfg" + ,(apply mixed-text-file "senpai.scfg" + (append (string-field "address" home-senpai-address) + (string-field "nickname" home-senpai-nickname) + (string-field "username" home-senpai-username) + (string-field "realname" home-senpai-realname) + (if (list? (home-senpai-password config)) + (string-list-field "password-cmd" home-senpai-password) + (string-field "password" home-senpai-password)) + (string-list-field "channel" home-senpai-channels) + (string-list-field "highlight" home-senpai-highlight-words) + (boolean-field "on-highlight-beep" home-senpai-highlight-beep?) + (string-field "on-highlight-path" home-senpai-highlight-script) + (record-field "pane-widths" + (integer-field "nicknames" home-senpai-nicknames-width) + (integer-field "channels" home-senpai-channels-width) + (integer-field "members" home-senpai-members-width) + (integer-field "text" home-senpai-message-width)) + (boolean-field "tls" home-senpai-tls?) + (boolean-field "typings" home-senpai-typing-notify?) + (boolean-field "mouse" home-senpai-mouse?) + (record-field "colors" + (colour-field "prompt" home-senpai-prompt-color) + (colour-field "unread" home-senpai-unread-color)) + (boolean-field "debug" home-senpai-debug?)))))) + +(define home-senpai-service-type + (service-type + (name 'home-senpai) + (extensions + (list (service-extension home-xdg-configuration-files-service-type + home-senpai-xdg-configuration-files))) + (description + "Configure senpai, a terminal-based IRC client designed for use +with bouncers."))) diff --git a/gnu/local.mk b/gnu/local.mk index 9a1aad300e..3bb4f2a353 100644 --- a/gnu/local.mk +++ b/gnu/local.mk @@ -90,6 +90,7 @@ GNU_SYSTEM_MODULES = \ %D%/home/services/symlink-manager.scm \ %D%/home/services/fontutils.scm \ %D%/home/services/guix.scm \ + %D%/home/services/irc.scm \ %D%/home/services/pm.scm \ %D%/home/services/shells.scm \ %D%/home/services/shepherd.scm \ -- 2.38.0