From 2746e071801c5ca037479191f865c91a5373f5cb Mon Sep 17 00:00:00 2001 From: Sughosha Date: Tue, 3 Mar 2026 23:48:41 +0530 Subject: [PATCH] services: readymedia: Allow relative paths to media directories. * gnu/services/upnp.scm (readymedia-activation): For home services, if the media directory paths are relative, create it in the user's home directory. * doc/guix.texi (Miscellaneous Services)[DLNA/UPnP Services]: Update doc. Change-Id: I39176320d6c33c56c5b80ad9e67e989ee41565da --- doc/guix.texi | 3 ++- gnu/services/upnp.scm | 21 +++++++++++++++------ 2 files changed, 17 insertions(+), 7 deletions(-) diff --git a/doc/guix.texi b/doc/guix.texi index 4c113518fa..15ed74ed0c 100644 --- a/doc/guix.texi +++ b/doc/guix.texi @@ -47045,7 +47045,8 @@ folder. @table @asis @item @code{path} (type: string) -The media folder location. +The media folder location. For Guix Home services, if the path is +relative, it will be looked up in the user's home directory. @item @code{types} (default: @code{'()}) (type: list) A list indicating the types of file included in the media folder. diff --git a/gnu/services/upnp.scm b/gnu/services/upnp.scm index 8ae6c2f928..16c3246353 100644 --- a/gnu/services/upnp.scm +++ b/gnu/services/upnp.scm @@ -224,12 +224,21 @@ (use-modules (gnu build activation)) (for-each (lambda (directory) - (unless (file-exists? directory) - (mkdir-p/perms directory - (getpw #$(if home-service? - #~(getuid) - %readymedia-user-account)) - #$(if home-service? #o755 #o775)))) + (let ((directory + (if #$home-service? + (if (absolute-file-name? directory) + directory + (string-append (or (getenv "HOME") + (passwd:dir + (getpwuid (getuid)))) + "/" directory)) + directory))) + (unless (file-exists? directory) + (mkdir-p/perms directory + (getpw #$(if home-service? + #~(getuid) + %readymedia-user-account)) + #$(if home-service? #o755 #o775))))) (list #$@(map readymedia-media-directory-path media-directories))) (for-each (lambda (directory)