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