From patchwork Tue Apr 22 00:11:47 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Ian Eure X-Patchwork-Id: 41911 Return-Path: X-Original-To: patchwork@mira.cbaines.net Delivered-To: patchwork@mira.cbaines.net Received: by mira.cbaines.net (Postfix, from userid 113) id F2B2D27BC4B; Tue, 22 Apr 2025 01:13:43 +0100 (BST) X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on mira.cbaines.net X-Spam-Level: X-Spam-Status: No, score=-6.4 required=5.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,MAILING_LIST_MULTI,RCVD_IN_DNSWL_BLOCKED, RCVD_IN_VALIDITY_CERTIFIED,RCVD_IN_VALIDITY_RPBL,RCVD_IN_VALIDITY_SAFE, SPF_HELO_PASS,URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.6 Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mira.cbaines.net (Postfix) with ESMTPS id A80E727BC49 for ; Tue, 22 Apr 2025 01:13:42 +0100 (BST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1u71GM-0007lY-2M; Mon, 21 Apr 2025 20:13:26 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1u71G3-0007kA-VH for guix-patches@gnu.org; Mon, 21 Apr 2025 20:13:07 -0400 Received: from debbugs.gnu.org ([2001:470:142:5::43]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1u71G3-0001cF-Eo for guix-patches@gnu.org; Mon, 21 Apr 2025 20:13:03 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=debbugs.gnu.org; s=debbugs-gnu-org; h=MIME-Version:Date:From:To:In-Reply-To:References:Subject; bh=x25KN6c1k3ihBJrDHthYEmQbpfZJ1nbFdrDa6VNb/Bs=; b=bYxQ6QR9YHUSwl6XxCwAnlFluG177oRnUIph4CTVijoCNMjxIJqecd49g4/vkd7gnqRNnw00/2UpgWG30IYWxS5p9cqVPbQR8F83L5LVRpWeYIm1SKWta2rEhz+pw+mr4nf6KWeQwrgF7l8SiKW/vzECllUlW13WWeajBuDahqY6mPd0qAPjWW1ajWp/J8J1cVebRLaiV45PlGBWujRpUWGJdde2KbHTVmCR2D7Fy4VnPFqYHzTegeqVGcQ1VsYBX7dwT0lMBi6c1wE/gIjSiFEN7z42kJz5I1MAsFjkm6RxSI/Hhtzkm9rAQs+zGED4F5Y1OdL48HxSykbWIeyoFg==; Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1u71G2-0005h7-8m for guix-patches@gnu.org; Mon, 21 Apr 2025 20:13:02 -0400 X-Loop: help-debbugs@gnu.org Subject: [bug#69692] [PATCH v3] gnu: Add home-jellyfin-mpv-shim-service-type. References: <7d396f735f82369731c90195c7b8e7dc0fcf9acd.1710048182.git.ian@retrospec.tv> In-Reply-To: <7d396f735f82369731c90195c7b8e7dc0fcf9acd.1710048182.git.ian@retrospec.tv> Resent-From: Ian Eure Original-Sender: "Debbugs-submit" Resent-CC: guix-patches@gnu.org Resent-Date: Tue, 22 Apr 2025 00:13:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 69692 X-GNU-PR-Package: guix-patches X-GNU-PR-Keywords: patch To: 69692@debbugs.gnu.org Cc: Ian Eure Received: via spool by 69692-submit@debbugs.gnu.org id=B69692.174528073521818 (code B ref 69692); Tue, 22 Apr 2025 00:13:02 +0000 Received: (at 69692) by debbugs.gnu.org; 22 Apr 2025 00:12:15 +0000 Received: from localhost ([127.0.0.1]:41135 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1u71FG-0005fp-Vg for submit@debbugs.gnu.org; Mon, 21 Apr 2025 20:12:15 -0400 Received: from fhigh-a8-smtp.messagingengine.com ([103.168.172.159]:50651) by debbugs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.84_2) (envelope-from ) id 1u71FC-0005fY-Cm for 69692@debbugs.gnu.org; Mon, 21 Apr 2025 20:12:12 -0400 Received: from phl-compute-03.internal (phl-compute-03.phl.internal [10.202.2.43]) by mailfhigh.phl.internal (Postfix) with ESMTP id 9E3D311400C5; Mon, 21 Apr 2025 20:12:04 -0400 (EDT) Received: from phl-mailfrontend-02 ([10.202.2.163]) by phl-compute-03.internal (MEProxy); Mon, 21 Apr 2025 20:12:04 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=retrospec.tv; h= cc:cc:content-transfer-encoding:content-type:content-type:date :date:from:from:in-reply-to:message-id:mime-version:reply-to :subject:subject:to:to; s=fm1; t=1745280724; x=1745367124; bh=x2 5KN6c1k3ihBJrDHthYEmQbpfZJ1nbFdrDa6VNb/Bs=; b=iFxfy3n45x0XWx04rZ oajaifc3QKVW7Wvhf20sIn5h7MFosB/FLFWqerDup7itLXkHgrkA9Eow0xbmZgf3 gQ89Eh5nf9M6C8MO0zNlKixODgKPFEC7CkctohOQGmVD+EDIi6Lf8G/Wksh3m3lD 1+YGrMXFEcccDpC+Oem4rejU5AfL2DAVSpau/pGBp/oJQhkGisqEWyH2ozsRt3rw 5GGXltWK6IcjzAtvHzXzVNng16i4Fbm0kGp/6DxzpnnvwlmpjPifgk60pMlXYNhn Ck9yHAuBtoQGjcN42QwRaHorO6ttc/iV7Xh8YlL4EhVPE8VKzp5eL7Oaxe/CZZwE CPqQ== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:cc:content-transfer-encoding :content-type:content-type:date:date:feedback-id:feedback-id :from:from:in-reply-to:message-id:mime-version:reply-to:subject :subject:to:to:x-me-proxy:x-me-sender:x-me-sender:x-sasl-enc; s= fm2; t=1745280724; x=1745367124; bh=x25KN6c1k3ihBJrDHthYEmQbpfZJ 1nbFdrDa6VNb/Bs=; b=kNMhEjoPhW/Dn6802FTYYPcdgAr0wwz27563vqkr+xeB U9lEoiluK9+KflFc3kkZmcVMMkT8cv5R0t+zJinXdIyUO3OXROqG4joZn4eboh1o NeqWq5EdBwqkrLwNWpyrtbQlqG9pd8CtgNlD3xAfIud2vZQXgkfMT8H73Kxr4FxC 2KmoSPEWtGyut6MmY0Wx2/KQBLb8KOySAZPxl8yKfbknjofB1vzagduV1/tkya/u ysu9hacKPuy+NDbD9lx9LEpS5A+hTcMGR4mLeaNb4ajcf+NGr4oo6gIZspRvrAaa ZdnB6YMXjjhwD2XPC4bsogyHXrdlGC8+cCGe2a6kMA== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgeefvddrtddtgddvgedvvdeiucetufdoteggodetrf dotffvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdggtfgfnhhsuhgsshgtrhhisggv pdfurfetoffkrfgpnffqhgenuceurghilhhouhhtmecufedttdenucenucfjughrpefhvf evufffkffogggtgfesthekredtredtjeenucfhrhhomhepkfgrnhcugfhurhgvuceoihgr nhesrhgvthhrohhsphgvtgdrthhvqeenucggtffrrghtthgvrhhnpeefgeejhedtheevff etleffheduudefueehfeevgeehtefghfffffeklefgvdevgfenucffohhmrghinhepkhho ughirdhtvhdpjhgvlhhlhihfihhnrdhorhhgnecuvehluhhsthgvrhfuihiivgeptdenuc frrghrrghmpehmrghilhhfrhhomhepihgrnhesrhgvthhrohhsphgvtgdrthhvpdhnsggp rhgtphhtthhopedvpdhmohguvgepshhmthhpohhuthdprhgtphhtthhopeeileeiledvse guvggssghughhsrdhgnhhurdhorhhgpdhrtghpthhtohepihgrnhesrhgvthhrohhsphgv tgdrthhv X-ME-Proxy: Feedback-ID: id9014242:Fastmail Received: by mail.messagingengine.com (Postfix) with ESMTPA; Mon, 21 Apr 2025 20:12:03 -0400 (EDT) From: Ian Eure Date: Mon, 21 Apr 2025 17:11:47 -0700 Message-ID: <20250422001149.19852-1-ian@retrospec.tv> X-Mailer: git-send-email 2.49.0 MIME-Version: 1.0 X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-BeenThere: guix-patches@gnu.org List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: guix-patches-bounces+patchwork=mira.cbaines.net@gnu.org Sender: guix-patches-bounces+patchwork=mira.cbaines.net@gnu.org X-getmail-retrieved-from-mailbox: Patches * 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 +;;; Copyright © 2024, 2025 Ian Eure ;;; ;;; 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.")))