Package: guix-patches;
Reported by: Ian Eure <ian <at> retrospec.tv>
Date: Sun, 10 Mar 2024 05:26:02 UTC
Severity: normal
Tags: patch
To reply to this bug, email your comments to 69692 AT debbugs.gnu.org.
Toggle the display of automated, internal messages from the tracker.
View this report as an mbox folder, status mbox, maintainer mbox
, guix-patches <at> gnu.org
:bug#69692
; Package guix-patches
.
(Sun, 10 Mar 2024 05:26:02 GMT) Full text and rfc822 format available.Ian Eure <ian <at> retrospec.tv>
:, guix-patches <at> gnu.org
.
(Sun, 10 Mar 2024 05:26:02 GMT) Full text and rfc822 format available.Message #5 received at submit <at> debbugs.gnu.org (full text, mbox):
From: Ian Eure <ian <at> retrospec.tv> To: guix-patches <at> gnu.org Cc: Ian Eure <ian <at> retrospec.tv> Subject: [PATCH] gnu: Add home-jellyfin-mpv-shim-service-type. Date: Sat, 9 Mar 2024 21:24:26 -0800
Split off from 67120. * gnu/home/services/media.scm (home-jellyfin-mpv-shim-service-type): New variable. * doc/guix.texi (Jellyfin Services): New section. * doc/guix.texi (Kodi Services): Add subheading. Change-Id: I037ab0602214fdaa1b032be51ff98ecf6b7ee16c --- doc/guix.texi | 19 +++++++++++++++++ gnu/home/services/media.scm | 42 +++++++++++++++++++++++++++++++++++++ 2 files changed, 61 insertions(+) diff --git a/doc/guix.texi b/doc/guix.texi index 858d5751bf..8a3aead56a 100644 --- a/doc/guix.texi +++ b/doc/guix.texi @@ -46383,6 +46383,8 @@ Media Home Services @subsection Media Home Services @cindex kodi +@subsubheading Kodi Services + The @uref{https://kodi.tv, Kodi media center} can be run as a daemon on a media server. With the @code{(gnu home services kodi)} service, you can configure Kodi to run upon login. @@ -46415,6 +46417,23 @@ Media Home Services @end table @end deftp +@cindex jellyfin +@subsubheading Jellyfin Services + +The @code{home-jellyfin-mpv-shim-service-type} in the @code{(gnu home services media)} module runs a cast client for the @uref{https://jellyfin.org/, Jellyfin} media system. + +To enable, add this to your home services: + +@lisp +(service home-jellyfin-mpv-shim-service-type #f) +@end lisp + +The service only starts if @code{jellyfin-mpv-shim} has been configured with a remote server and credentials. This must be done manually, by launching @code{jellyfin-mpv-shim}. After configuring the server, the service will start automatically when you log in. + +@defvar home-jellyfin-mpv-shim-service-type +The type of the Jellyfin MPV Shim service. +@end defvar + @node Networking Home Services @subsection Networking Home Services diff --git a/gnu/home/services/media.scm b/gnu/home/services/media.scm index c6454dfe15..a7fcf75b06 100644 --- a/gnu/home/services/media.scm +++ b/gnu/home/services/media.scm @@ -19,8 +19,10 @@ (define-module (gnu home services media) #:use-module (srfi srfi-26) #:use-module (gnu home services) + #:use-module (gnu home services desktop) #:use-module (gnu home services shepherd) #:use-module (gnu packages kodi) + #:use-module (gnu packages video) #:use-module (gnu services configuration) #:use-module (gnu services shepherd) #:use-module (guix records) @@ -66,3 +68,43 @@ (define home-kodi-service-type (description "Install and configure the Kodi media center so that it runs as a Shepherd service."))) + +(define (jellyfin-mpv-shim-shepherd-service _ignore) + (list (shepherd-service + (documentation "Jellyfin MPV Shim.") + (provision '(jellyfin-mpv-shim jellyfin-client)) + + ;; Depend on 'x11-display', which sets 'DISPLAY' if an X11 server is + ;; available, and fails to start otherwise. + (requirement '(x11-display)) + + (modules '((srfi srfi-1) + (srfi srfi-26) + (srfi srfi-98))) + (start #~(lambda _ + ;; Only start if a server has been configured. + (if (file-exists? + (string-append + (get-environment-variable "XDG_CONFIG_HOME") + "/jellyfin-mpv-shim/cred.json")) + (fork+exec-command + (list #$(file-append jellyfin-mpv-shim "/bin/jellyfin-mpv-shim")) + + ;; Inherit the 'DISPLAY' variable set by 'x11-display'. + #:environment-variables + (cons (string-append "DISPLAY=" (getenv "DISPLAY")) + (remove (cut string-prefix? "DISPLAY=" <>) + (default-environment-variables)))) + #f))) + (stop #~(make-kill-destructor))))) + +(define-public home-jellyfin-mpv-shim-service-type + (service-type + (name 'home-jellyfin-mpv-shim) + (extensions (list (service-extension home-shepherd-service-type + jellyfin-mpv-shim-shepherd-service) + ;; Ensure 'home-x11-service-type' is instantiated so we + ;; can depend on the Shepherd 'x11-display' service. + (service-extension home-x11-service-type + (const #t)))) + (description "Run Jellyfin MPV Shim."))) base-commit: 7758e63f7a89f53fbb7c7a265ae472af0a8dfab0 -- 2.41.0
guix-patches <at> gnu.org
:bug#69692
; Package guix-patches
.
(Mon, 18 Mar 2024 22:16:02 GMT) Full text and rfc822 format available.Message #8 received at 69692 <at> debbugs.gnu.org (full text, mbox):
From: Skyler Ferris <skyvine <at> protonmail.com> To: Ian Eure <ian <at> retrospec.tv>, 69692 <at> debbugs.gnu.org Subject: Re: [bug#69692] [PATCH] gnu: Add home-jellyfin-mpv-shim-service-type. Date: Mon, 18 Mar 2024 22:14:08 +0000
[Message part 1 (text/plain, inline)]
Hi Ian, I don't have the setup required to try running this service but 2 things stand out to me when reading through it. On 3/9/24 21:24, Ian Eure wrote: > +To enable, add this to your home services: > + > +@lisp > +(service home-jellyfin-mpv-shim-service-type #f) > +@end lisp You can add a default-value field to the service definition like so: (define-public home-jellyfin-mpv-shim-service-type (service-type (name 'home-jellyfin-mpv-shim) (default-value #f) (extensions (list (service-extension home-shepherd-service-type jellyfin-mpv-shim-shepherd-service) ;; Ensure 'home-x11-service-type' is instantiated so we ;; can depend on the Shepherd 'x11-display' service. (service-extension home-x11-service-type (const #t)))) (description "Run Jellyfin MPV Shim."))) Then, users can simply use (service home-jellyfish-mpv-shim-service-type) without having to specify #f manually And if the service ever changes in the future and this value becomes useful then you can provide a reasonable default without requiring users to change their code. (https://guix.gnu.org/manual/en/html_node/Service-Reference.html) > + > +The service only starts if @code{jellyfin-mpv-shim} has been configured with a remote server and credentials. This must be done manually, by launching @code{jellyfin-mpv-shim}. After configuring the server, the service will start automatically when you log in. Would it make sense to launch this program automatically if it is not configured? Presumably if someone adds the service then they want to configure a server. The value passed to the service could be used to specify whether or not the program should automatically launch so that users who do not want this behavior can disable it (note that if you decide to implement this then the configuration value should be an instance of a new structure defined to store configuration for this service, not a simple boolean; again, this makes things easier in the future so that if you want to add more fields pre-existing code will still work). Regards, Skyler
[Message part 2 (text/html, inline)]
guix-patches <at> gnu.org
:bug#69692
; Package guix-patches
.
(Thu, 16 May 2024 01:50:02 GMT) Full text and rfc822 format available.Message #11 received at 69692 <at> debbugs.gnu.org (full text, mbox):
From: Ian Eure <ian <at> retrospec.tv> To: Skyler Ferris <skyvine <at> protonmail.com> Cc: 69692 <at> debbugs.gnu.org Subject: Re: [bug#69692] [PATCH] gnu: Add home-jellyfin-mpv-shim-service-type. Date: Wed, 15 May 2024 18:27:58 -0700
Hi Skyler, Sorry for the extremely delayed response here. Skyler Ferris <skyvine <at> protonmail.com> writes: > Hi Ian, > > I don't have the setup required to try running this service but > 2 things stand out to me when reading through it. > > On 3/9/24 21:24, Ian Eure wrote: > > +To enable, add this to your home services: > + > +@lisp > +(service home-jellyfin-mpv-shim-service-type #f) > +@end lisp > > You can add a default-value field to the service definition like > so: > > (define-public home-jellyfin-mpv-shim-service-type > (service-type > (name 'home-jellyfin-mpv-shim) > (default-value #f) > (extensions (list (service-extension > home-shepherd-service-type > jellyfin-mpv-shim-shepherd-service) > ;; Ensure 'home-x11-service-type' is > instantiated so we > ;; can depend on the Shepherd 'x11-display' > service. > (service-extension home-x11-service-type > (const #t)))) > (description "Run Jellyfin MPV Shim."))) > Then, users can simply use (service > home-jellyfish-mpv-shim-service-type) without having to specify > #f manually And if the > service ever changes in the future and this value becomes useful > then you can provide a reasonable default without requiring > users to change their > code. (https://guix.gnu.org/manual/en/html_node/Service-Reference.html) > Thank you for the suggestion, I’ll incorporate it and send a revised patch after we’re in agreement on the launch behavior. > + > +The service only starts if @code{jellyfin-mpv-shim} has been > configured with a remote server and credentials. This must be > done manually, by launching @code{jellyfin-mpv-shim}. After > configuring the server, the service will start automatically > when you log in. > > Would it make sense to launch this program automatically if it > is not configured? > I don’t think it would. When it launches in an unconfigured state, you get a very generic "Server Configuration" window, with no icon or indication what server you’re configuring, or what for. It makes perfect sense if you run the program and that window appears, and not much sense at all if it just happens when you log in. > Presumably if someone adds the service then they want to > configure a server. Agreed. However, configuring the server is a manual action, and it doesn’t feel burdensome to manually run the program to do it. There isn’t a good way to configure the remote server declaratively, since this process involves exchanging a username and password for an authentication token, which must be done over the network. You probably wouldn’t want to commit your auth token to a repo containing your home configuration, and Guix has no facility for securely handling things like this. So it has to be done by hand. > The value passed to the service could be used to specify whether > or not the program should automatically launch so that users who > do not want this behavior can disable it (note that if you > decide to implement this then the configuration value should be > an instance of a new structure defined to store configuration > for this service, not a simple boolean; again, this makes things > easier in the future so that if you want to add more fields > pre-existing code will still work). > Making auto-launch configurable doesn’t seem like a good idea to me. It would only ever apply to the very first launch, and wouldn’t significantly change the bounds of the problem. If the default is to launch unconfigured, you get the confusing behavior I want to avoid. If the default is to not launch unconfigured, I don’t think anyone would ever change that setting -- it’s be much easier to launch the program than to change the setting and `guix home reconfigure'. Thanks, — Ian
guix-patches <at> gnu.org
:bug#69692
; Package guix-patches
.
(Thu, 22 Aug 2024 15:01:01 GMT) Full text and rfc822 format available.Message #14 received at 69692 <at> debbugs.gnu.org (full text, mbox):
From: Ian Eure <ian <at> retrospec.tv> To: Skyler Ferris <skyvine <at> protonmail.com> Cc: 69692 <at> debbugs.gnu.org Subject: Re: [bug#69692] [PATCH] gnu: Add home-jellyfin-mpv-shim-service-type. Date: Thu, 22 Aug 2024 07:57:28 -0700
Hi Skyler, Did you have any other thoughts or feedback on this patch? I’d like to see this in Guix proper. Thanks, — Ian Ian Eure <ian <at> retrospec.tv> writes: > Hi Skyler, > > Sorry for the extremely delayed response here. > > Skyler Ferris <skyvine <at> protonmail.com> writes: > >> Hi Ian, >> >> I don't have the setup required to try running this service but >> 2 >> things stand out to me when reading through it. >> >> On 3/9/24 21:24, Ian Eure wrote: >> >> +To enable, add this to your home services: >> + >> +@lisp >> +(service home-jellyfin-mpv-shim-service-type #f) >> +@end lisp >> >> You can add a default-value field to the service definition >> like so: >> >> (define-public home-jellyfin-mpv-shim-service-type >> (service-type >> (name 'home-jellyfin-mpv-shim) >> (default-value #f) >> (extensions (list (service-extension >> home-shepherd-service-type >> jellyfin-mpv-shim-shepherd-service) >> ;; Ensure 'home-x11-service-type' is >> instantiated so we >> ;; can depend on the Shepherd >> 'x11-display' >> service. >> (service-extension home-x11-service-type >> (const #t)))) >> (description "Run Jellyfin MPV Shim."))) >> Then, users can simply use (service >> home-jellyfish-mpv-shim-service-type) without having to specify >> #f >> manually And if the >> service ever changes in the future and this value becomes >> useful >> then you can provide a reasonable default without requiring >> users to change their >> code. (https://guix.gnu.org/manual/en/html_node/Service-Reference.html) >> > > Thank you for the suggestion, I’ll incorporate it and send a > revised > patch after we’re in agreement on the launch behavior. > >> + >> +The service only starts if @code{jellyfin-mpv-shim} has been >> configured with a remote server and credentials. This must be >> done >> manually, by launching @code{jellyfin-mpv-shim}. After >> configuring >> the server, the service will start automatically when you log >> in. >> >> Would it make sense to launch this program automatically if it >> is >> not configured? >> > > I don’t think it would. When it launches in an unconfigured > state, > you get a very generic "Server Configuration" window, with no > icon or > indication what server you’re configuring, or what for. It makes > perfect sense if you run the program and that window appears, > and not > much sense at all if it just happens when you log in. > > >> Presumably if someone adds the service then they want to >> configure a >> server. > > Agreed. However, configuring the server is a manual action, and > it > doesn’t feel burdensome to manually run the program to do > it. There > isn’t a good way to configure the remote server declaratively, > since > this process involves exchanging a username and password for an > authentication token, which must be done over the network. You > probably wouldn’t want to commit your auth token to a repo > containing > your home configuration, and Guix has no facility for securely > handling things like this. So it has to be done by hand. > > >> The value passed to the service could be used to specify >> whether or >> not the program should automatically launch so that users who >> do not >> want this behavior can disable it (note that if you decide to >> implement this then the configuration value should be an >> instance of >> a new structure defined to store configuration for this >> service, not >> a simple boolean; again, this makes things easier in the future >> so >> that if you want to add more fields pre-existing code will >> still >> work). >> > > Making auto-launch configurable doesn’t seem like a good idea to > me. > It would only ever apply to the very first launch, and wouldn’t > significantly change the bounds of the problem. If the default > is to > launch unconfigured, you get the confusing behavior I want to > avoid. > If the default is to not launch unconfigured, I don’t think > anyone > would ever change that setting -- it’s be much easier to launch > the > program than to change the setting and `guix home reconfigure'. > > Thanks, > > — Ian
guix-patches <at> gnu.org
:bug#69692
; Package guix-patches
.
(Sun, 08 Sep 2024 23:11:02 GMT) Full text and rfc822 format available.Message #17 received at 69692 <at> debbugs.gnu.org (full text, mbox):
From: Ian Eure <ian <at> retrospec.tv> To: 69692 <at> debbugs.gnu.org Cc: Ian Eure <ian <at> retrospec.tv> Subject: [PATCH v2 0/1] gnu: Add home-jellyfin-mpv-shim-service-type. Date: Sun, 8 Sep 2024 16:10:19 -0700
Refreshed patch, rebased onto current master. Ian Eure (1): gnu: Add home-jellyfin-mpv-shim-service-type. doc/guix.texi | 19 +++++++++++++++++ gnu/home/services/media.scm | 42 +++++++++++++++++++++++++++++++++++++ 2 files changed, 61 insertions(+) -- 2.45.2
guix-patches <at> gnu.org
:bug#69692
; Package guix-patches
.
(Sun, 08 Sep 2024 23:11:02 GMT) Full text and rfc822 format available.Message #20 received at 69692 <at> debbugs.gnu.org (full text, mbox):
From: Ian Eure <ian <at> retrospec.tv> To: 69692 <at> debbugs.gnu.org Cc: Ian Eure <ian <at> retrospec.tv> Subject: [PATCH v2 1/1] gnu: Add home-jellyfin-mpv-shim-service-type. Date: Sun, 8 Sep 2024 16:10:20 -0700
* gnu/home/services/media.scm (home-jellyfin-mpv-shim-service-type): New variable. * doc/guix.texi (Jellyfin Services): New section. * doc/guix.texi (Kodi Services): Add subheading. Change-Id: I037ab0602214fdaa1b032be51ff98ecf6b7ee16c --- doc/guix.texi | 19 +++++++++++++++++ gnu/home/services/media.scm | 42 +++++++++++++++++++++++++++++++++++++ 2 files changed, 61 insertions(+) diff --git a/doc/guix.texi b/doc/guix.texi index 981ffb8c58..c60b350d06 100644 --- a/doc/guix.texi +++ b/doc/guix.texi @@ -47072,6 +47072,8 @@ znc} for more information. @subsection Media Home Services @cindex kodi +@subsubheading Kodi Services + The @uref{https://kodi.tv, Kodi media center} can be run as a daemon on a media server. With the @code{(gnu home services kodi)} service, you can configure Kodi to run upon login. @@ -47104,6 +47106,23 @@ kodi} for more information. @end table @end deftp +@cindex jellyfin +@subsubheading Jellyfin Services + +The @code{home-jellyfin-mpv-shim-service-type} in the @code{(gnu home services media)} module runs a cast client for the @uref{https://jellyfin.org/, Jellyfin} media system. + +To enable, add this to your home services: + +@lisp +(service home-jellyfin-mpv-shim-service-type #f) +@end lisp + +The service only starts if @code{jellyfin-mpv-shim} has been configured with a remote server and credentials. This must be done manually, by launching @code{jellyfin-mpv-shim}. After configuring the server, the service will start automatically when you log in. + +@defvar home-jellyfin-mpv-shim-service-type +The type of the Jellyfin MPV Shim service. +@end defvar + @node Networking Home Services @subsection Networking Home Services diff --git a/gnu/home/services/media.scm b/gnu/home/services/media.scm index c6454dfe15..a7fcf75b06 100644 --- a/gnu/home/services/media.scm +++ b/gnu/home/services/media.scm @@ -19,8 +19,10 @@ (define-module (gnu home services media) #:use-module (srfi srfi-26) #:use-module (gnu home services) + #:use-module (gnu home services desktop) #:use-module (gnu home services shepherd) #:use-module (gnu packages kodi) + #:use-module (gnu packages video) #:use-module (gnu services configuration) #:use-module (gnu services shepherd) #:use-module (guix records) @@ -66,3 +68,43 @@ (define home-kodi-service-type (description "Install and configure the Kodi media center so that it runs as a Shepherd service."))) + +(define (jellyfin-mpv-shim-shepherd-service _ignore) + (list (shepherd-service + (documentation "Jellyfin MPV Shim.") + (provision '(jellyfin-mpv-shim jellyfin-client)) + + ;; Depend on 'x11-display', which sets 'DISPLAY' if an X11 server is + ;; available, and fails to start otherwise. + (requirement '(x11-display)) + + (modules '((srfi srfi-1) + (srfi srfi-26) + (srfi srfi-98))) + (start #~(lambda _ + ;; Only start if a server has been configured. + (if (file-exists? + (string-append + (get-environment-variable "XDG_CONFIG_HOME") + "/jellyfin-mpv-shim/cred.json")) + (fork+exec-command + (list #$(file-append jellyfin-mpv-shim "/bin/jellyfin-mpv-shim")) + + ;; Inherit the 'DISPLAY' variable set by 'x11-display'. + #:environment-variables + (cons (string-append "DISPLAY=" (getenv "DISPLAY")) + (remove (cut string-prefix? "DISPLAY=" <>) + (default-environment-variables)))) + #f))) + (stop #~(make-kill-destructor))))) + +(define-public home-jellyfin-mpv-shim-service-type + (service-type + (name 'home-jellyfin-mpv-shim) + (extensions (list (service-extension home-shepherd-service-type + jellyfin-mpv-shim-shepherd-service) + ;; Ensure 'home-x11-service-type' is instantiated so we + ;; can depend on the Shepherd 'x11-display' service. + (service-extension home-x11-service-type + (const #t)))) + (description "Run Jellyfin MPV Shim."))) -- 2.45.2
guix-patches <at> gnu.org
:bug#69692
; Package guix-patches
.
(Sat, 15 Feb 2025 17:43:02 GMT) Full text and rfc822 format available.Message #23 received at 69692 <at> debbugs.gnu.org (full text, mbox):
From: Ian Eure <ian <at> retrospec.tv> To: Skyler Ferris <skyvine <at> protonmail.com> Cc: 69692 <at> debbugs.gnu.org Subject: Re: [bug#69692] [PATCH] gnu: Add home-jellyfin-mpv-shim-service-type. Date: Sat, 15 Feb 2025 09:42:05 -0800
Hi Skyler, Pinging on this since it’s been nearly a year since I sent the patch. I have commit privileges now, and am inclined to rebase and push unless someone objects. -- Ian
guix-patches <at> gnu.org
:bug#69692
; Package guix-patches
.
(Tue, 22 Apr 2025 00:13:02 GMT) Full text and rfc822 format available.Message #26 received at 69692 <at> debbugs.gnu.org (full text, mbox):
From: Ian Eure <ian <at> retrospec.tv> To: 69692 <at> debbugs.gnu.org Cc: Ian Eure <ian <at> retrospec.tv> Subject: [PATCH v3] gnu: Add home-jellyfin-mpv-shim-service-type. Date: Mon, 21 Apr 2025 17:11:47 -0700
* gnu/home/services/media.scm (home-jellyfin-mpv-shim-service-type): New variable. * doc/guix.texi (Jellyfin Services): New section. * doc/guix.texi (Kodi Services): Add subheading. Change-Id: I037ab0602214fdaa1b032be51ff98ecf6b7ee16c --- doc/guix.texi | 28 ++++++++++++++++++ gnu/home/services/media.scm | 59 ++++++++++++++++++++++++++++++++++++- 2 files changed, 86 insertions(+), 1 deletion(-) diff --git a/doc/guix.texi b/doc/guix.texi index bf9cb47478..988c2d69d4 100644 --- a/doc/guix.texi +++ b/doc/guix.texi @@ -50426,6 +50426,8 @@ an example of a service and its configuration that you could add to the @subsection Media Home Services @cindex kodi +@subsubheading Kodi Services + The @uref{https://kodi.tv, Kodi media center} can be run as a daemon on a media server. With the @code{(gnu home services kodi)} service, you can configure Kodi to run upon login. @@ -50861,6 +50863,32 @@ mouse bindings. @end table @end deftp +@cindex jellyfin +@subsubheading Jellyfin Services + +The @code{home-jellyfin-mpv-shim-service-type} in the @code{(gnu home services media)} module runs a cast client for the @uref{https://jellyfin.org/, Jellyfin} media system. + +To enable, add this to your home services: + +@lisp +(service home-jellyfin-mpv-shim-service-type) +@end lisp + +The service starts only if @code{jellyfin-mpv-shim} has been configured with a remote server and credentials. This must be done manually, by launching @code{jellyfin-mpv-shim}. After configuring the server, the service will start automatically when you log in. + +@defvar home-jellyfin-mpv-shim-service-type +Type of the service which launches Jellyfin MPV Shim. +@end defvar + +@deftp {Data Type} home-jellyfin-mpv-shim-configuration +Available @code{home-jellyfin-mpv-shim-configuration} fields are: + +@table @asis +@item @code{package} (default: @code{jellyfin-mpv-shim}) (type: package) +The Jellyfin MPV Shim package to use. +@end table +@end deftp + @node Networking Home Services @subsection Networking Home Services diff --git a/gnu/home/services/media.scm b/gnu/home/services/media.scm index c6454dfe15..1fd11e0e16 100644 --- a/gnu/home/services/media.scm +++ b/gnu/home/services/media.scm @@ -1,5 +1,6 @@ ;;; GNU Guix --- Functional package management for GNU ;;; Copyright © 2023 Janneke Nieuwenhuizen <janneke <at> gnu.org> +;;; Copyright © 2024, 2025 Ian Eure <ian <at> retrospec.tv> ;;; ;;; This file is part of GNU Guix. ;;; @@ -19,14 +20,20 @@ (define-module (gnu home services media) #:use-module (srfi srfi-26) #:use-module (gnu home services) + #:use-module (gnu home services desktop) #:use-module (gnu home services shepherd) #:use-module (gnu packages kodi) + #:use-module (gnu packages video) #:use-module (gnu services configuration) #:use-module (gnu services shepherd) + #:use-module (guix packages) #:use-module (guix records) #:use-module (guix gexp) #:export (home-kodi-configuration - home-kodi-service-type)) + home-kodi-service-type + + home-jellyfin-mpv-shim-configuration + home-jellyfin-mpv-shim-service-type)) ;;; @@ -66,3 +73,53 @@ (define home-kodi-service-type (description "Install and configure the Kodi media center so that it runs as a Shepherd service."))) + +(define-configuration home-jellyfin-mpv-shim-configuration + (package + (package jellyfin-mpv-shim) + "The Jellyfin MPV Shim package to use")) + +(define (jellyfin-mpv-shim-shepherd-service config) + (list (shepherd-service + (documentation "Jellyfin MPV Shim.") + (provision '(jellyfin-mpv-shim jellyfin-client)) + + ;; Depend on 'x11-display', which sets 'DISPLAY' if an X11 server is + ;; available, and fails to start otherwise. + (requirement '(x11-display)) + + (modules '((srfi srfi-1) + (srfi srfi-26) + (srfi srfi-98))) + (start + #~(lambda _ + ;; Only start if a server has been configured. + (if (file-exists? + (string-append + (get-environment-variable "XDG_CONFIG_HOME") + "/jellyfin-mpv-shim/cred.json")) + (fork+exec-command + (list + #$(file-append + (home-jellyfin-mpv-shim-configuration-package config) + "/bin/jellyfin-mpv-shim")) + + ;; Inherit the 'DISPLAY' variable set by 'x11-display'. + #:environment-variables + (cons (string-append "DISPLAY=" (getenv "DISPLAY")) + (remove (cut string-prefix? "DISPLAY=" <>) + (default-environment-variables)))) + #f))) + (stop #~(make-kill-destructor))))) + +(define-public home-jellyfin-mpv-shim-service-type + (service-type + (name 'home-jellyfin-mpv-shim) + (extensions (list (service-extension home-shepherd-service-type + jellyfin-mpv-shim-shepherd-service) + ;; Ensure 'home-x11-service-type' is instantiated so we + ;; can depend on the Shepherd 'x11-display' service. + (service-extension home-x11-service-type + (const #t)))) + (default-value (home-jellyfin-mpv-shim-configuration)) + (description "Run Jellyfin MPV Shim."))) -- 2.49.0
guix-patches <at> gnu.org
:bug#69692
; Package guix-patches
.
(Tue, 22 Apr 2025 04:21:02 GMT) Full text and rfc822 format available.Message #29 received at 69692 <at> debbugs.gnu.org (full text, mbox):
From: Hilton Chain <hako <at> ultrarare.space> To: Ian Eure <ian <at> retrospec.tv> Cc: 69692 <at> debbugs.gnu.org Subject: Re: [bug#69692] [PATCH v3] gnu: Add home-jellyfin-mpv-shim-service-type. Date: Tue, 22 Apr 2025 12:19:42 +0800
On Tue, 22 Apr 2025 08:11:47 +0800, Ian Eure wrote: > > [...] > + ;; Inherit the 'DISPLAY' variable set by 'x11-display'. > + #:environment-variables > + (cons (string-append "DISPLAY=" (getenv "DISPLAY")) > + (remove (cut string-prefix? "DISPLAY=" <>) > + (default-environment-variables)))) > + #f))) I think this is not the truth (also for existing services using it), ‘getenv’ is called before starting services, see https://issues.guix.gnu.org/76619#8 for details. > + (stop #~(make-kill-destructor))))) > + > +(define-public home-jellyfin-mpv-shim-service-type > + (service-type > + (name 'home-jellyfin-mpv-shim) > + (extensions (list (service-extension home-shepherd-service-type > + jellyfin-mpv-shim-shepherd-service) > + ;; Ensure 'home-x11-service-type' is instantiated so we > + ;; can depend on the Shepherd 'x11-display' service. > + (service-extension home-x11-service-type > + (const #t)))) > + (default-value (home-jellyfin-mpv-shim-configuration)) > + (description "Run Jellyfin MPV Shim."))) > -- > 2.49.0 Thanks
guix-patches <at> gnu.org
:bug#69692
; Package guix-patches
.
(Mon, 12 May 2025 02:11:02 GMT) Full text and rfc822 format available.Message #32 received at 69692 <at> debbugs.gnu.org (full text, mbox):
From: Ian Eure <ian <at> retrospec.tv> To: Hilton Chain <hako <at> ultrarare.space> Cc: 69692 <at> debbugs.gnu.org Subject: Re: [bug#69692] [PATCH v3] gnu: Add home-jellyfin-mpv-shim-service-type. Date: Sun, 11 May 2025 19:10:42 -0700
Hi Hilton, Hilton Chain <hako <at> ultrarare.space> writes: > On Tue, 22 Apr 2025 08:11:47 +0800, > Ian Eure wrote: >> >> [...] >> + ;; Inherit the 'DISPLAY' variable set by >> 'x11-display'. >> + #:environment-variables >> + (cons (string-append "DISPLAY=" (getenv >> "DISPLAY")) >> + (remove (cut string-prefix? >> "DISPLAY=" <>) >> + >> (default-environment-variables)))) >> + #f))) > > I think this is not the truth (also for existing services using > it), ‘getenv’ is > called before starting services, see > https://issues.guix.gnu.org/76619#8 for > details. Yeah, hmm, I see. Is there anything worth changing in this service at this point? Seems like it’s need an update whenever the graphical-display service changes land. Thanks, -- Ian
GNU bug tracking system
Copyright (C) 1999 Darren O. Benham,
1997,2003 nCipher Corporation Ltd,
1994-97 Ian Jackson.