projects/guix·blob python-team · refs

83 lines · 3.1 KiB

1;;; GNU Guix --- Functional package management for GNU
2;;; Copyright © 2023, 2025 Janneke Nieuwenhuizen <[email protected]>
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 #:use-module (gnu home services)
22 #:use-module (gnu home services shepherd)
23 #:use-module (gnu packages irc)
24 #:use-module (gnu packages messaging)
25 #:use-module (gnu services)
26 #:use-module (gnu services configuration)
27 #:use-module (gnu services shepherd)
28 #:use-module (gnu services messaging)
29 #:use-module ((gnu system shadow) #:select (account-service-type))
30 #:use-module (guix records)
31 #:use-module (guix gexp)
32 #:export (home-snuik-service-type
33 home-znc-configuration
34 home-znc-service-type))
35
36;;;
37;;; Znc.
38;;;
39(define-record-type* <home-znc-configuration>
40 home-znc-configuration make-home-znc-configuration
41 home-znc-configuration?
42 (znc home-znc-znc ;string
43 (default znc))
44 (extra-options home-znc-extra-options ;list of string
45 (default '())))
46
47(define (home-znc-services config)
48 "Return a <shepherd-service> for znc with CONFIG."
49 (match-record config <home-znc-configuration>
50 (znc extra-options)
51 (let* ((znc (file-append znc "/bin/znc"))
52 (command #~'(#$znc "--foreground" #$@extra-options))
53 (log-file #~(string-append %user-log-dir "/znc.log")))
54 (list (shepherd-service
55 (documentation "Run the znc IRC bouncer.")
56 (provision '(znc))
57 (modules '((shepherd support))) ;for '%user-log-dir'
58 (start #~(make-forkexec-constructor #$command
59 #:log-file #$log-file))
60 (stop #~(make-kill-destructor)))))))
61
62(define home-znc-service-type
63 (service-type
64 (name 'home-znc)
65 (default-value (home-znc-configuration))
66 (extensions
67 (list (service-extension home-shepherd-service-type
68 home-znc-services)))
69 (description
70 "Install and configure @command{znc}, an @acronym{IRC, Internet Relay
71Chat} bouncer, as a Shepherd service.")))
72
73
74;;;
75;;; Snuik.
76;;;
77(define home-snuik-service-type
78 (service-type
79 (inherit (system->home-service-type
80 (remove-service-extensions snuik-service-type
81 (list account-service-type
82 activation-service-type))))
83 (default-value (for-home (snuik-configuration)))))