summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJan (janneke) Nieuwenhuizen <janneke@gnu.org>2023-03-05 17:38:50 +0100
committerJanneke Nieuwenhuizen <janneke@gnu.org>2023-03-16 14:32:50 +0100
commit193f547ca35eb49ef57bd9a25b67cb3965f10b03 (patch)
tree6bf8fa7915d2b148f50c756627d467afce547b99
parent2c2f382e757d5eef39e8460a20ac75a1b1f8b22e (diff)
gnu: home: services: Add home-znc-service-type.
* gnu/home/services/messaging.scm: New file. * gnu/local.mk (GNU_SYSTEM_MODULES): Add it. * po/guix/POTFILES.in: Likewise. * doc/guix.texi (Messaging Home Services): Document it in new subsection.
-rw-r--r--doc/guix.texi37
-rw-r--r--gnu/home/services/messaging.scm73
-rw-r--r--gnu/local.mk3
-rw-r--r--po/guix/POTFILES.in1
4 files changed, 113 insertions, 1 deletions
diff --git a/doc/guix.texi b/doc/guix.texi
index 8baa2f32240..a823d5f27d8 100644
--- a/doc/guix.texi
+++ b/doc/guix.texi
@@ -41705,6 +41705,7 @@ services)}.
41705* Guix: Guix Home Services. Services for Guix. 41705* Guix: Guix Home Services. Services for Guix.
41706* Fonts: Fonts Home Services. Services for managing User's fonts. 41706* Fonts: Fonts Home Services. Services for managing User's fonts.
41707* Sound: Sound Home Services. Dealing with audio. 41707* Sound: Sound Home Services. Dealing with audio.
41708* Messaging: Messaging Home Services. Services for managing messaging.
41708@end menu 41709@end menu
41709@c In addition to that Home Services can provide 41710@c In addition to that Home Services can provide
41710 41711
@@ -42797,6 +42798,42 @@ Stopping the Shepherd service turns off broadcasting.
42797This is the multicast address used by default by the two services above. 42798This is the multicast address used by default by the two services above.
42798@end defvar 42799@end defvar
42799 42800
42801@node Messaging Home Services
42802@subsection Messaging Home Services
42803
42804@cindex znc
42805The @uref{https://znc.in, ZNC bouncer} can be run as a daemon to manage
42806your IRC presence. With the @code{(gnu home services znc)} service, you
42807can configure ZNC to run upon login.
42808
42809You will have to provide a @file{~/.znc/configs/znc.conf} seperately.
42810
42811Here is an example of a service and its configuration that you could add
42812to the @code{services} field of your @code{home-environment}:
42813
42814@lisp
42815(service home-znc-service-type)
42816@end lisp
42817
42818@defvr {Scheme Variable} home-znc-service-type
42819This is the type of the @code{git daemon} home service, whose value is an
42820@code{home-znc-configuration} object.
42821@end defvr
42822
42823@deftp {Data Type} home-znc-configuration
42824Available @code{home-znc-configuration} fields are:
42825
42826@table @asis
42827@item @code{git} (default: @code{git}) (type: file-like)
42828The git package to use.
42829
42830@item @code{extra-options} (default: @code{'()})
42831Extra options will be passed to @command{znc}, please run @command{man
42832znc} for more information.
42833
42834@end table
42835@end deftp
42836
42800@node Invoking guix home 42837@node Invoking guix home
42801@section Invoking @command{guix home} 42838@section Invoking @command{guix home}
42802 42839
diff --git a/gnu/home/services/messaging.scm b/gnu/home/services/messaging.scm
new file mode 100644
index 00000000000..d403b84ac98
--- /dev/null
+++ b/gnu/home/services/messaging.scm
@@ -0,0 +1,73 @@
1;;; GNU Guix --- Functional package management for GNU
2;;; Copyright © 2023 Janneke Nieuwenhuizen <janneke@gnu.org>
3;;;
4;;; This file is part of GNU Guix.
5;;;
6;;; GNU Guix is free software; you can redistribute it and/or modify it
7;;; under the terms of the GNU General Public License as published by
8;;; the Free Software Foundation; either version 3 of the License, or (at
9;;; your option) any later version.
10;;;
11;;; GNU Guix is distributed in the hope that it will be useful, but
12;;; WITHOUT ANY WARRANTY; without even the implied warranty of
13;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14;;; GNU General Public License for more details.
15;;;
16;;; You should have received a copy of the GNU General Public License
17;;; along with GNU Guix. If not, see <http://www.gnu.org/licenses/>.
18
19(define-module (gnu home services messaging)
20 #:use-module (srfi srfi-26)
21
22 #:use-module (ice-9 match)
23
24 #:use-module (shepherd support)
25
26 #:use-module (gnu home services)
27 #:use-module (gnu home services shepherd)
28 #:use-module (gnu packages messaging)
29 #:use-module (gnu services configuration)
30 #:use-module (gnu services shepherd)
31 #:use-module (guix records)
32 #:use-module (guix gexp)
33
34 #:export (home-znc-configuration
35 home-znc-service-type))
36
37;;;
38;;; Znc.
39;;;
40(define-record-type* <home-znc-configuration>
41 home-znc-configuration make-home-znc-configuration
42 home-znc-configuration?
43 (znc home-znc-znc ;string
44 (default znc))
45 (extra-options home-znc-extra-options ;list of string
46 (default '())))
47
48(define (home-znc-services config)
49 "Return a <shepherd-service> for znc with CONFIG."
50 (match config
51 (($ <home-znc-configuration> znc extra-options)
52 (let* ((znc (file-append znc "/bin/znc"))
53 (command `(,znc
54 "--foreground"
55 ,@extra-options))
56 (log-file (string-append %user-log-dir "/znc.log")))
57 (list (shepherd-service
58 (documentation "Run the znc IRC bouncer.")
59 (provision '(znc))
60 (start #~(make-forkexec-constructor '#$command
61 #:log-file #$log-file))
62 (stop #~(make-kill-destructor))))))))
63
64(define home-znc-service-type
65 (service-type
66 (name 'home-znc)
67 (default-value (home-znc-configuration))
68 (extensions
69 (list (service-extension home-shepherd-service-type
70 home-znc-services)))
71 (description
72 "Install and configure @command{znc}, an @acronym{IRC, Internet Relay
73Chat} bouncer, as a Shepherd service.")))
diff --git a/gnu/local.mk b/gnu/local.mk
index eafd7c40ea2..c87ce6fa8c7 100644
--- a/gnu/local.mk
+++ b/gnu/local.mk
@@ -11,7 +11,7 @@
11# Copyright © 2016 Ben Woodcroft <donttrustben@gmail.com> 11# Copyright © 2016 Ben Woodcroft <donttrustben@gmail.com>
12# Copyright © 2016, 2017, 2018, 2019 Alex Vong <alexvong1995@gmail.com> 12# Copyright © 2016, 2017, 2018, 2019 Alex Vong <alexvong1995@gmail.com>
13# Copyright © 2016, 2017, 2018, 2019, 2020, 2021 Efraim Flashner <efraim@flashner.co.il> 13# Copyright © 2016, 2017, 2018, 2019, 2020, 2021 Efraim Flashner <efraim@flashner.co.il>
14# Copyright © 2016, 2017, 2018, 2019, 2020, 2021, 2022 Jan (janneke) Nieuwenhuizen <janneke@gnu.org> 14# Copyright © 2016, 2017, 2018, 2019, 2020, 2021, 2022, 2023 Jan (janneke) Nieuwenhuizen <janneke@gnu.org>
15# Copyright © 2017, 2018, 2019, 2020 Tobias Geerinckx-Rice <me@tobias.gr> 15# Copyright © 2017, 2018, 2019, 2020 Tobias Geerinckx-Rice <me@tobias.gr>
16# Copyright © 2017, 2018 Clément Lassieur <clement@lassieur.org> 16# Copyright © 2017, 2018 Clément Lassieur <clement@lassieur.org>
17# Copyright © 2017, 2020 Mathieu Othacehe <m.othacehe@gmail.com> 17# Copyright © 2017, 2020 Mathieu Othacehe <m.othacehe@gmail.com>
@@ -91,6 +91,7 @@ GNU_SYSTEM_MODULES = \
91 %D%/home/services/symlink-manager.scm \ 91 %D%/home/services/symlink-manager.scm \
92 %D%/home/services/fontutils.scm \ 92 %D%/home/services/fontutils.scm \
93 %D%/home/services/guix.scm \ 93 %D%/home/services/guix.scm \
94 %D%/home/services/messaging.scm \
94 %D%/home/services/pm.scm \ 95 %D%/home/services/pm.scm \
95 %D%/home/services/shells.scm \ 96 %D%/home/services/shells.scm \
96 %D%/home/services/shepherd.scm \ 97 %D%/home/services/shepherd.scm \
diff --git a/po/guix/POTFILES.in b/po/guix/POTFILES.in
index 7009fc756cb..c71a6ca8579 100644
--- a/po/guix/POTFILES.in
+++ b/po/guix/POTFILES.in
@@ -13,6 +13,7 @@ gnu/services/shepherd.scm
13gnu/services/samba.scm 13gnu/services/samba.scm
14gnu/services/version-control.scm 14gnu/services/version-control.scm
15gnu/home/services.scm 15gnu/home/services.scm
16gnu/home/services/messaging.scm
16gnu/home/services/ssh.scm 17gnu/home/services/ssh.scm
17gnu/home/services/symlink-manager.scm 18gnu/home/services/symlink-manager.scm
18gnu/system/file-systems.scm 19gnu/system/file-systems.scm