[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[bug#61483] [PATCH 3/5] DRAFT gnu: home: services: Add home-znc-service-
From: |
Janneke Nieuwenhuizen |
Subject: |
[bug#61483] [PATCH 3/5] DRAFT gnu: home: services: Add home-znc-service-type. |
Date: |
Mon, 13 Feb 2023 17:50:55 +0100 |
From: "Janneke Nieuwenhuizen" <janneke@gnu.org>
* gnu/home/services/shepherd-xyz.scm
(<home-znc-configuration>): New type.
(home-znc-services): New procedure.
(home-znc-service-type): New variable.
---
gnu/home/services/shepherd-xyz.scm | 43 +++++++++++++++++++++++++++++-
1 file changed, 42 insertions(+), 1 deletion(-)
diff --git a/gnu/home/services/shepherd-xyz.scm
b/gnu/home/services/shepherd-xyz.scm
index 38ab7d60ef..4f2a2435ac 100644
--- a/gnu/home/services/shepherd-xyz.scm
+++ b/gnu/home/services/shepherd-xyz.scm
@@ -22,6 +22,7 @@ (define-module (gnu home services shepherd-xyz)
#:use-module (gnu home services)
#:use-module (gnu home services shepherd)
+ #:use-module (gnu packages messaging)
#:use-module (gnu packages ssh)
#:use-module (gnu packages version-control)
#:use-module (gnu services configuration)
@@ -32,7 +33,9 @@ (define-module (gnu home services shepherd-xyz)
#:export (home-git-daemon-configuration
home-git-daemon-service-type
home-ssh-agent-configuration
- home-ssh-agent-service-type))
+ home-ssh-agent-service-type
+ home-znc-configuration
+ home-znc-service-type))
;;; Commentary:
;;
@@ -156,3 +159,41 @@ (define home-ssh-agent-service-type
home-ssh-agent-services)))
(description
"Install and configure the ssh-agent as a shepherd service.")))
+
+
+;;;
+;;; Znc.
+;;;
+(define-record-type* <home-znc-configuration>
+ home-znc-configuration make-home-znc-configuration
+ home-znc-configuration?
+ (znc home-znc-znc ;string
+ (default #~(string-append #$znc "/bin/znc")))
+ (log-dir home-znc-log-dir ;string
+ (default %user-log-dir)))
+
+(define (home-znc-services config)
+ "Return a <shepherd-service> for znc with CONFIG."
+ (match config
+ (($ <home-znc-configuration> znc log-dir)
+ (list (shepherd-service
+ (documentation "Run the znc IRC bouncer.")
+ (provision '(znc))
+ (start #~(lambda _
+ (unless (file-exists? #$log-dir)
+ (mkdir-p #$log-dir))
+ (fork+exec-command
+ (list #$znc
+ "--foreground")
+ #:log-file (string-append #$log-dir "/znc.log"))))
+ (stop #~(make-kill-destructor)))))))
+
+(define home-znc-service-type
+ (service-type
+ (name 'home-znc)
+ (default-value (home-znc-configuration))
+ (extensions
+ (list (service-extension home-shepherd-service-type
+ home-znc-services)))
+ (description
+ "Install and configure znc as a shepherd service.")))
--
2.38.1