GNU bug report logs - #77023
[PATCH 0/3] home: services: Add readymedia.

Previous Next

Package: guix-patches;

Reported by: Sughosha <sughosha <at> disroot.org>

Date: Sat, 15 Mar 2025 02:03:01 UTC

Severity: normal

Tags: moreinfo, patch

Done: Ludovic Courtès <ludo <at> gnu.org>

Bug is archived. No further changes may be made.

To add a comment to this bug, you must first unarchive it, by sending
a message to control AT debbugs.gnu.org, with unarchive 77023 in the body.
You can then email your comments to 77023 AT debbugs.gnu.org in the normal way.

Toggle the display of automated, internal messages from the tracker.

View this report as an mbox folder, status mbox, maintainer mbox


Report forwarded to andrew <at> trop.in, janneke <at> gnu.org, ludo <at> gnu.org, maxim.cournoyer <at> gmail.com, tanguy <at> bioneland.org, guix-patches <at> gnu.org:
bug#77023; Package guix-patches. (Sat, 15 Mar 2025 02:03:01 GMT) Full text and rfc822 format available.

Acknowledgement sent to Sughosha <sughosha <at> disroot.org>:
New bug report received and forwarded. Copy sent to andrew <at> trop.in, janneke <at> gnu.org, ludo <at> gnu.org, maxim.cournoyer <at> gmail.com, tanguy <at> bioneland.org, guix-patches <at> gnu.org. (Sat, 15 Mar 2025 02:03:01 GMT) Full text and rfc822 format available.

Message #5 received at submit <at> debbugs.gnu.org (full text, mbox):

From: Sughosha <sughosha <at> disroot.org>
To: guix-patches <at> gnu.org
Cc: Ludovic Courtès <ludo <at> gnu.org>,
 Sughosha <sughosha <at> disroot.org>
Subject: [PATCH 0/3] home: services: Add readymedia.
Date: Sat, 15 Mar 2025 07:31:10 +0530
This set of patches updates homepage of the 'readymedia' package and the URL of
the documentation of ReadyMedia Service; make 'readymedia-configuration',
'readymedia-shepherd-service' and 'readymedia-activation' compatible to be
wrapped with 'for-home'; adds 'home-readymedia-service-type', a home
counterpart of 'readymedia-service-type'.

Sughosha (3):
  gnu: readymedia: Update home-page.
  doc: Update ReadyMedia url.
  home: services: Add readymedia.

 doc/guix.texi              | 47 +++++++++++++++++++++++++++++++-
 gnu/home/services/upnp.scm | 55 ++++++++++++++++++++++++++++++++++++++
 gnu/local.mk               |  1 +
 gnu/packages/upnp.scm      |  2 +-
 gnu/services/upnp.scm      | 45 ++++++++++++++++++++++---------
 5 files changed, 136 insertions(+), 14 deletions(-)
 create mode 100644 gnu/home/services/upnp.scm


base-commit: e124661486ec722b5c09a94b416f0104b9dde5a4
-- 
2.48.1





Information forwarded to guix-patches <at> gnu.org:
bug#77023; Package guix-patches. (Sat, 15 Mar 2025 02:05:02 GMT) Full text and rfc822 format available.

Message #8 received at 77023 <at> debbugs.gnu.org (full text, mbox):

From: Sughosha <sughosha <at> disroot.org>
To: 77023 <at> debbugs.gnu.org
Cc: Ludovic Courtès <ludo <at> gnu.org>,
 Sughosha <sughosha <at> disroot.org>
Subject: [PATCH 1/3] gnu: readymedia: Update home-page.
Date: Sat, 15 Mar 2025 07:33:43 +0530
* gnu/packages/upnp.scm (readymedia): Update home-page.

Change-Id: I11f38874c362025e03fa3f0706e57b32d3706edd
---
 gnu/packages/upnp.scm | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/gnu/packages/upnp.scm b/gnu/packages/upnp.scm
index e49c39ef574..9a58e6d7f62 100644
--- a/gnu/packages/upnp.scm
+++ b/gnu/packages/upnp.scm
@@ -174,7 +174,7 @@ (define-public readymedia
            libvorbis
            sqlite
            zlib))
-    (home-page "https://sourceforge.net/projects/minidlna/")
+    (home-page "https://minidlna.sourceforge.net/")
     (synopsis "DLNA/UPnP-AV media server")
     (description "ReadyMedia (formerly known as MiniDLNA) is a simple media
 server, which serves multimedia content to compatible clients on the network.
-- 
2.48.1





Information forwarded to ludo <at> gnu.org, maxim.cournoyer <at> gmail.com, guix-patches <at> gnu.org:
bug#77023; Package guix-patches. (Sat, 15 Mar 2025 02:05:02 GMT) Full text and rfc822 format available.

Message #11 received at 77023 <at> debbugs.gnu.org (full text, mbox):

From: Sughosha <sughosha <at> disroot.org>
To: 77023 <at> debbugs.gnu.org
Cc: Ludovic Courtès <ludo <at> gnu.org>,
 Sughosha <sughosha <at> disroot.org>
Subject: [PATCH 2/3] doc: Update ReadyMedia url.
Date: Sat, 15 Mar 2025 07:33:44 +0530
* doc/guix.texi (DLNA/UPnP Services): Update ReadyMedia url.

Change-Id: Ief346066edd6b9e679f020a6ff8528856cf853d9
---
 doc/guix.texi | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/doc/guix.texi b/doc/guix.texi
index d109877a32c..02da0a2ee98 100644
--- a/doc/guix.texi
+++ b/doc/guix.texi
@@ -43931,7 +43931,7 @@ Miscellaneous Services
 media streaming and device interoperability within a local network.  For
 now, this module provides the @code{readymedia-service-type}.
 
-@uref{https://sourceforge.net/projects/minidlna/, ReadyMedia} (formerly
+@uref{https://minidlna.sourceforge.net/, ReadyMedia} (formerly
 known as MiniDLNA) is a DLNA/UPnP-AV media server.  The project's
 daemon, @code{minidlnad}, can serve media files (audio, pictures, and
 video) to DLNA/UPnP-AV clients available on the network.
-- 
2.48.1





Information forwarded to andrew <at> trop.in, janneke <at> gnu.org, ludo <at> gnu.org, maxim.cournoyer <at> gmail.com, tanguy <at> bioneland.org, guix-patches <at> gnu.org:
bug#77023; Package guix-patches. (Sat, 15 Mar 2025 02:05:03 GMT) Full text and rfc822 format available.

Message #14 received at 77023 <at> debbugs.gnu.org (full text, mbox):

From: Sughosha <sughosha <at> disroot.org>
To: 77023 <at> debbugs.gnu.org
Cc: Ludovic Courtès <ludo <at> gnu.org>,
 Sughosha <sughosha <at> disroot.org>
Subject: [PATCH 3/3] home: services: Add readymedia.
Date: Sat, 15 Mar 2025 07:33:45 +0530
* gnu/home/services/upnp.scm: New file.
* gnu/local.mk: Register it.
* gnu/services/upnp.scm: Export readymedia-activation and
readymedia-shepherd-service.
(<readymedia-configuration>)[home-service?]: New field.
[cache-directory]: Adjust value depending on 'for-home?'.
[log-directory]: Ditto.
(readymedia-shepherd-service): Adjust 'requirement' and 'start' according to
'home-service?'.
(readymedia-activation): Adjust creating directories with permissions according
to 'home-service?'.
* doc/guix.texi (Miscellaneous Home Services): Document Readymedia Service.
(Miscellaneous Services): Add cross-reference.

Change-Id: I57ec25726e716ca6600ef23b636523c48fd5041f
---
 doc/guix.texi              | 45 +++++++++++++++++++++++++++++++
 gnu/home/services/upnp.scm | 55 ++++++++++++++++++++++++++++++++++++++
 gnu/local.mk               |  1 +
 gnu/services/upnp.scm      | 45 ++++++++++++++++++++++---------
 4 files changed, 134 insertions(+), 12 deletions(-)
 create mode 100644 gnu/home/services/upnp.scm

diff --git a/doc/guix.texi b/doc/guix.texi
index 02da0a2ee98..0cb4573e4db 100644
--- a/doc/guix.texi
+++ b/doc/guix.texi
@@ -43965,6 +43965,12 @@ Miscellaneous Services
 field is mandatory.  All other fields (such as network ports and the
 server name) come with a predefined default and can be omitted.
 
+@quotation Note
+This service is also available for Guix Home, where it runs directly
+with your user privileges (@pxref{Miscellaneous Home Services,
+@code{home-readymedia-service-type}}).
+@end quotation
+
 @c %start of fragment
 
 @deftp {Data Type} readymedia-configuration
@@ -50159,6 +50165,8 @@ Networking Home Services
 This section lists services somewhat networking-related that you may use
 with Guix Home.
 
+@subheading Syncthing Service
+
 @cindex Syncthing, file synchronization service
 @cindex backup service, Syncthing
 The @code{(gnu home services syncthing)} module provides a service to
@@ -50261,6 +50269,43 @@ Miscellaneous Home Services
           (dicod-configuration @dots{})))
 @end lisp
 
+@subheading ReadyMedia Service
+
+@cindex ReadyMedia, DLNA/UPnP Service
+The @code{(gnu home services upnp)} module provides a service to set up
+the @uref{https://minidlna.sourceforge.net/, ReadyMedia} @acronym{DLNA,
+Digital Living Network Alliance} @acronym{UPnP, Universal Plug and Play}
+media server.
+
+@defvar home-readymedia-service-type
+This is the service type for the @command{minidlnad} daemon; it is the
+Home counterpart of the @code{readymedia-service-type} system service
+(@pxref{Miscellaneous Services, @code{readymedia-service-type}}).  The value
+for this service type is a @code{readymedia-configuration}.
+@end defvar
+
+The service can be used with a @code{readymedia-configuration} wrapped in
+@code{for-home} like this:
+
+@lisp
+(service home-readymedia-service-type
+         (for-home
+          (readymedia-configuration
+            (media-directories
+             (list (readymedia-directory
+                     (path "/path/to/media/audio")
+                     (types '(A)))
+                   (readymedia-directory
+                     (path "/path/to/media/video")
+                     (types '(V)))
+                   (readymedia-directory
+                     (path "/path/to/media/misc")))))))
+@end lisp
+
+For details about @code{readymedia-configuration}, check out the
+documentation of the system service (@pxref{Miscellaneous Services,
+@code{readymedia-service-type}}).
+
 @node Invoking guix home
 @section Invoking @command{guix home}
 
diff --git a/gnu/home/services/upnp.scm b/gnu/home/services/upnp.scm
new file mode 100644
index 00000000000..869c8e0c4a7
--- /dev/null
+++ b/gnu/home/services/upnp.scm
@@ -0,0 +1,55 @@
+;;; GNU Guix --- Functional package management for GNU
+;;; Copyright �� 2025 Sughosha <sughosha <at> disroot.org>
+;;;
+;;; This file is part of GNU Guix.
+;;;
+;;; GNU Guix is free software; you can redistribute it and/or modify it
+;;; under the terms of the GNU General Public License as published by
+;;; the Free Software Foundation; either version 3 of the License, or (at
+;;; your option) any later version.
+;;;
+;;; GNU Guix is distributed in the hope that it will be useful, but
+;;; WITHOUT ANY WARRANTY; without even the implied warranty of
+;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+;;; GNU General Public License for more details.
+;;;
+;;; You should have received a copy of the GNU General Public License
+;;; along with GNU Guix.  If not, see <http://www.gnu.org/licenses/>.
+
+(define-module (gnu home services upnp)
+  #:use-module ((gnu build linux-container) #:select (%namespaces))
+  #:use-module (gnu services)
+  #:use-module (gnu home services)
+  ;; For the 'home-shepherd-service-type' mapping.
+  #:use-module (gnu home services shepherd)
+  #:use-module (gnu services upnp)
+  #:use-module (guix records)
+  #:export (home-readymedia-service-type)
+  #:re-export (readymedia-configuration
+               readymedia-configuration?
+               readymedia-configuration-readymedia
+               readymedia-configuration-port
+               readymedia-configuration-cache-directory
+               readymedia-configuration-extra-config
+               readymedia-configuration-friendly-name
+               readymedia-configuration-log-directory
+               readymedia-configuration-media-directories
+               readymedia-media-directory
+               readymedia-media-directory?
+               readymedia-media-directory-path
+               readymedia-media-directory-types))
+
+(define home-readymedia-service-type
+  (service-type
+   (inherit (system->home-service-type readymedia-service-type))
+   ;; system->home-service-type does not convert special-files-service-type to
+   ;; home-files-service-type, so redefine extensios
+   (extensions
+    (list (service-extension home-shepherd-service-type
+                             (compose list readymedia-shepherd-service))
+          (service-extension home-activation-service-type
+                             readymedia-activation)))
+   (default-value
+    (for-home
+     (readymedia-configuration
+       (media-directories '()))))))
diff --git a/gnu/local.mk b/gnu/local.mk
index 149ef8dff9a..6f7929bee8b 100644
--- a/gnu/local.mk
+++ b/gnu/local.mk
@@ -122,6 +122,7 @@ GNU_SYSTEM_MODULES =				\
   %D%/home/services/sway.scm			\
   %D%/home/services/syncthing.scm		\
   %D%/home/services/mcron.scm			\
+  %D%/home/services/upnp.scm			\
   %D%/home/services/utils.scm			\
   %D%/home/services/xdg.scm			\
   %D%/image.scm					\
diff --git a/gnu/services/upnp.scm b/gnu/services/upnp.scm
index c125c07af24..e4bafced53d 100644
--- a/gnu/services/upnp.scm
+++ b/gnu/services/upnp.scm
@@ -50,7 +50,9 @@ (define-module (gnu services upnp)
             readymedia-media-directory-path
             readymedia-media-directory-types
             readymedia-media-directory?
-            readymedia-service-type))
+            readymedia-service-type
+            readymedia-activation
+            readymedia-shepherd-service))
 
 ;;; Commentary:
 ;;;
@@ -72,14 +74,27 @@ (define-record-type* <readymedia-configuration>
   (port readymedia-configuration-port
         (default #f))
   (cache-directory readymedia-configuration-cache-directory
-                   (default %readymedia-default-cache-directory))
+                   (default (if for-home?
+                                (string-append (or (getenv "XDG_CACHE_HOME")
+                                                   (string-append
+                                                    (getenv "HOME") "/.cache"))
+                                               "/readymedia")
+                              %readymedia-default-cache-directory)))
   (log-directory readymedia-configuration-log-directory
-                 (default %readymedia-default-log-directory))
+                 (default (if for-home?
+                              (string-append (or (getenv "XDG_STATE_HOME")
+                                                 (string-append
+                                                  (getenv "HOME")
+                                                  "/.local/state"))
+                                             "/readymedia")
+                            %readymedia-default-log-directory)))
   (friendly-name readymedia-configuration-friendly-name
                  (default #f))
   (media-directories readymedia-configuration-media-directories)
   (extra-config readymedia-configuration-extra-config
-                (default '())))
+                (default '()))
+  (home-service? syncthing-configuration-home-service?
+                 (default for-home?) (innate)))
 
 ;; READYMEDIA-MEDIA-DIR is a record that indicates the path of a media folder
 ;; and the types of media included within it. Allowed individual types are the
@@ -96,9 +111,13 @@ (define-record-type* <readymedia-media-directory>
 (define (readymedia-configuration->config-file config)
   "Return the ReadyMedia/MiniDLNA configuration file corresponding to CONFIG."
   (match-record config <readymedia-configuration>
-    (port friendly-name cache-directory log-directory media-directories extra-config)
+    (port friendly-name cache-directory log-directory media-directories
+     extra-config home-service?)
     (apply mixed-text-file
            "minidlna.conf"
+           (if home-service?
+               (string-append "user=" (number->string (getuid)) "\n")
+               "")
            "db_dir=" cache-directory "\n"
            "log_dir=" log-directory "\n"
            (if friendly-name
@@ -125,12 +144,12 @@ (define (readymedia-configuration->config-file config)
 (define (readymedia-shepherd-service config)
   "Return a least-authority ReadyMedia/MiniDLNA Shepherd service."
   (match-record config <readymedia-configuration>
-    (cache-directory log-directory media-directories)
+    (cache-directory log-directory media-directories home-service?)
     (let ((minidlna-conf (readymedia-configuration->config-file config)))
       (shepherd-service
        (documentation "Run the ReadyMedia/MiniDLNA daemon.")
        (provision '(readymedia))
-       (requirement '(networking user-processes))
+       (requirement (if home-service? '() '(networking user-processes)))
        (start
         #~(make-forkexec-constructor
            (list #$(least-authority-wrapper
@@ -159,8 +178,8 @@ (define (readymedia-shepherd-service config)
                  #$minidlna-conf
                  "-S")
            #:log-file #$(string-append log-directory "/" %readymedia-log-file)
-           #:user #$%readymedia-user-account
-           #:group #$%readymedia-user-group))
+           #:user #$(if home-service? #f %readymedia-user-account)
+           #:group #$(if home-service? #f %readymedia-user-group)))
        (stop #~(make-kill-destructor))))))
 
 (define readymedia-accounts
@@ -178,7 +197,7 @@ (define readymedia-accounts
 (define (readymedia-activation config)
   "Set up directories for ReadyMedia/MiniDLNA."
   (match-record config <readymedia-configuration>
-    (cache-directory log-directory media-directories)
+    (cache-directory log-directory media-directories home-service?)
     (with-imported-modules (source-module-closure '((gnu build activation)))
       #~(begin
           (use-modules (gnu build activation))
@@ -186,8 +205,10 @@ (define (readymedia-activation config)
           (for-each (lambda (directory)
                       (unless (file-exists? directory)
                         (mkdir-p/perms directory
-                                       (getpw #$%readymedia-user-account)
-                                       #o775)))
+                                       (getpw #$(if home-service?
+                                                    (getuid)
+                                                    %readymedia-user-account))
+                                       (if home-service? #o755 #o775))))
                     (list #$cache-directory
                           #$log-directory
                           #$@(map readymedia-media-directory-path
-- 
2.48.1





Information forwarded to ludo <at> gnu.org, maxim.cournoyer <at> gmail.com, guix-patches <at> gnu.org:
bug#77023; Package guix-patches. (Tue, 25 Mar 2025 14:30:02 GMT) Full text and rfc822 format available.

Message #17 received at 77023 <at> debbugs.gnu.org (full text, mbox):

From: Sughosha <sughosha <at> disroot.org>
To: 77023 <at> debbugs.gnu.org
Cc: Ludovic Courtès <ludo <at> gnu.org>,
 Sughosha <sughosha <at> disroot.org>
Subject: [PATCH v2 2/3] doc: Update ReadyMedia url.
Date: Tue, 25 Mar 2025 19:57:49 +0530
* doc/guix.texi (DLNA/UPnP Services): Update ReadyMedia url.

Change-Id: Ief346066edd6b9e679f020a6ff8528856cf853d9
---
 doc/guix.texi | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/doc/guix.texi b/doc/guix.texi
index 730fb457987..09d7ddbc16d 100644
--- a/doc/guix.texi
+++ b/doc/guix.texi
@@ -44152,7 +44152,7 @@ Miscellaneous Services
 media streaming and device interoperability within a local network.  For
 now, this module provides the @code{readymedia-service-type}.
 
-@uref{https://sourceforge.net/projects/minidlna/, ReadyMedia} (formerly
+@uref{https://minidlna.sourceforge.net/, ReadyMedia} (formerly
 known as MiniDLNA) is a DLNA/UPnP-AV media server.  The project's
 daemon, @code{minidlnad}, can serve media files (audio, pictures, and
 video) to DLNA/UPnP-AV clients available on the network.
-- 
2.48.1





Information forwarded to guix-patches <at> gnu.org:
bug#77023; Package guix-patches. (Tue, 25 Mar 2025 14:30:03 GMT) Full text and rfc822 format available.

Message #20 received at 77023 <at> debbugs.gnu.org (full text, mbox):

From: Sughosha <sughosha <at> disroot.org>
To: 77023 <at> debbugs.gnu.org
Cc: Ludovic Courtès <ludo <at> gnu.org>,
 Sughosha <sughosha <at> disroot.org>
Subject: [PATCH v2 1/3] gnu: readymedia: Update home-page.
Date: Tue, 25 Mar 2025 19:57:48 +0530
* gnu/packages/upnp.scm (readymedia): Update home-page.

Change-Id: I11f38874c362025e03fa3f0706e57b32d3706edd
---
 gnu/packages/upnp.scm | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/gnu/packages/upnp.scm b/gnu/packages/upnp.scm
index 035d58344dd..2479f093d16 100644
--- a/gnu/packages/upnp.scm
+++ b/gnu/packages/upnp.scm
@@ -174,7 +174,7 @@ (define-public readymedia
            libvorbis
            sqlite
            zlib))
-    (home-page "https://sourceforge.net/projects/minidlna/")
+    (home-page "https://minidlna.sourceforge.net/")
     (synopsis "DLNA/UPnP-AV media server")
     (description "ReadyMedia (formerly known as MiniDLNA) is a simple media
 server, which serves multimedia content to compatible clients on the network.

base-commit: 744cf07005745312ccddb549bb1bab5ab7031106
-- 
2.48.1





Information forwarded to guix-patches <at> gnu.org:
bug#77023; Package guix-patches. (Tue, 25 Mar 2025 14:37:02 GMT) Full text and rfc822 format available.

Message #23 received at 77023 <at> debbugs.gnu.org (full text, mbox):

From: Sughosha <sughosha <at> disroot.org>
To: 77023 <at> debbugs.gnu.org
Cc: Ludovic Courtès <ludo <at> gnu.org>,
 Sughosha <sughosha <at> disroot.org>
Subject: [PATCH v3 1/3] gnu: readymedia: Update home-page.
Date: Tue, 25 Mar 2025 20:05:46 +0530
* gnu/packages/upnp.scm (readymedia): Update home-page.

Change-Id: I11f38874c362025e03fa3f0706e57b32d3706edd
---
 gnu/packages/upnp.scm | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/gnu/packages/upnp.scm b/gnu/packages/upnp.scm
index 035d58344dd..2479f093d16 100644
--- a/gnu/packages/upnp.scm
+++ b/gnu/packages/upnp.scm
@@ -174,7 +174,7 @@ (define-public readymedia
            libvorbis
            sqlite
            zlib))
-    (home-page "https://sourceforge.net/projects/minidlna/")
+    (home-page "https://minidlna.sourceforge.net/")
     (synopsis "DLNA/UPnP-AV media server")
     (description "ReadyMedia (formerly known as MiniDLNA) is a simple media
 server, which serves multimedia content to compatible clients on the network.

base-commit: 744cf07005745312ccddb549bb1bab5ab7031106
-- 
2.48.1





Information forwarded to ludo <at> gnu.org, maxim.cournoyer <at> gmail.com, guix-patches <at> gnu.org:
bug#77023; Package guix-patches. (Tue, 25 Mar 2025 14:37:02 GMT) Full text and rfc822 format available.

Message #26 received at 77023 <at> debbugs.gnu.org (full text, mbox):

From: Sughosha <sughosha <at> disroot.org>
To: 77023 <at> debbugs.gnu.org
Cc: Ludovic Courtès <ludo <at> gnu.org>,
 Sughosha <sughosha <at> disroot.org>
Subject: [PATCH v3 2/3] doc: Update ReadyMedia url.
Date: Tue, 25 Mar 2025 20:05:47 +0530
* doc/guix.texi (DLNA/UPnP Services): Update ReadyMedia url.

Change-Id: Ief346066edd6b9e679f020a6ff8528856cf853d9
---
 doc/guix.texi | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/doc/guix.texi b/doc/guix.texi
index 730fb457987..09d7ddbc16d 100644
--- a/doc/guix.texi
+++ b/doc/guix.texi
@@ -44152,7 +44152,7 @@ Miscellaneous Services
 media streaming and device interoperability within a local network.  For
 now, this module provides the @code{readymedia-service-type}.
 
-@uref{https://sourceforge.net/projects/minidlna/, ReadyMedia} (formerly
+@uref{https://minidlna.sourceforge.net/, ReadyMedia} (formerly
 known as MiniDLNA) is a DLNA/UPnP-AV media server.  The project's
 daemon, @code{minidlnad}, can serve media files (audio, pictures, and
 video) to DLNA/UPnP-AV clients available on the network.
-- 
2.48.1





Information forwarded to guix-patches <at> gnu.org:
bug#77023; Package guix-patches. (Tue, 25 Mar 2025 14:47:02 GMT) Full text and rfc822 format available.

Message #29 received at 77023 <at> debbugs.gnu.org (full text, mbox):

From: Ludovic Courtès <ludo <at> gnu.org>
To: Sughosha <sughosha <at> disroot.org>
Cc: 77023 <at> debbugs.gnu.org
Subject: Re: [bug#77023] [PATCH v3 1/3] gnu: readymedia: Update home-page.
Date: Tue, 25 Mar 2025 15:46:35 +0100
Hi,

I think you forgot patch 3/3. :-)

Also, please make sure the series applies above
cfe68843a8bf8cded75e3901debc13023d1225b3.

Ludo’.




Information forwarded to guix-patches <at> gnu.org:
bug#77023; Package guix-patches. (Wed, 26 Mar 2025 08:26:01 GMT) Full text and rfc822 format available.

Message #32 received at 77023 <at> debbugs.gnu.org (full text, mbox):

From: Sughosha <sughosha <at> disroot.org>
To: Ludovic Courtès <ludo <at> gnu.org>
Cc: 77023 <at> debbugs.gnu.org
Subject: Re: [bug#77023] [PATCH v3 1/3] gnu: readymedia: Update home-page.
Date: Wed, 26 Mar 2025 13:54:35 +0530
[Message part 1 (text/plain, inline)]
On Tuesday, March 25, 2025 8:16:35 PM GMT+5:30 Ludovic Courtès wrote:
> Hi,
> 
> I think you forgot patch 3/3. :-)
> 
> Also, please make sure the series applies above
> cfe68843a8bf8cded75e3901debc13023d1225b3.
> 
> Ludo’.
I don't know what is wrong with the 3rd patch, I am not able to send the 3rd 
patch only, the mail is not getting delivered. I am getting an email saying 
"Undelivered Mail Returned to Sender" (you can see the attatchments). 
-- 
Sughosha
[attachment.1 (application/x-troff-man, attachment)]
[attachment.2 (application/x-troff-man, attachment)]
[signature.asc (application/pgp-signature, inline)]

Information forwarded to guix-patches <at> gnu.org:
bug#77023; Package guix-patches. (Wed, 26 Mar 2025 08:34:02 GMT) Full text and rfc822 format available.

Message #35 received at 77023 <at> debbugs.gnu.org (full text, mbox):

From: Sughosha <sughosha <at> disroot.org>
To: Ludovic Courtès <ludo <at> gnu.org>
Cc: 77023 <at> debbugs.gnu.org
Subject: Re: [bug#77023] [PATCH v3 1/3] gnu: readymedia: Update home-page.
Date: Wed, 26 Mar 2025 14:02:30 +0530
[Message part 1 (text/plain, inline)]
On Tuesday, March 25, 2025 8:16:35 PM GMT+5:30 Ludovic Courtès wrote:
> Hi,
> 
> I think you forgot patch 3/3. :-)
> 
> Also, please make sure the series applies above
> cfe68843a8bf8cded75e3901debc13023d1225b3.
> 
> Ludo’.
I don't know what is wrong with this patch, I am not able to send it with 'git 
send-email', the mail is not getting delivered. This is happening only to this 
patch. So I am now sending it as an attatchment to this.

-- 
Sughosha
[attachment.1 (application/x-troff-man, attachment)]
[attachment.2 (application/x-troff-man, attachment)]
[signature.asc (application/pgp-signature, inline)]

Information forwarded to guix-patches <at> gnu.org:
bug#77023; Package guix-patches. (Tue, 01 Apr 2025 07:55:07 GMT) Full text and rfc822 format available.

Message #38 received at 77023 <at> debbugs.gnu.org (full text, mbox):

From: Ludovic Courtès <ludo <at> gnu.org>
To: Sughosha <sughosha <at> disroot.org>
Cc: 77023 <at> debbugs.gnu.org
Subject: Re: [bug#77023] [PATCH v3 1/3] gnu: readymedia: Update home-page.
Date: Tue, 01 Apr 2025 09:54:43 +0200
Hi,

Sughosha <sughosha <at> disroot.org> skribis:

> I don't know what is wrong with this patch, I am not able to send it with 'git 
> send-email', the mail is not getting delivered. This is happening only to this 
> patch. So I am now sending it as an attatchment to this.

I didn’t get the patch here; the attachments are SMTP error logs.

Ludo’.




Information forwarded to guix-patches <at> gnu.org:
bug#77023; Package guix-patches. (Thu, 03 Apr 2025 10:57:01 GMT) Full text and rfc822 format available.

Message #41 received at 77023 <at> debbugs.gnu.org (full text, mbox):

From: Sughosha <sughosha <at> disroot.org>
To: Ludovic Courtès <ludo <at> gnu.org>
Cc: 77023 <at> debbugs.gnu.org
Subject: Re: [bug#77023] [PATCH v3 1/3] gnu: readymedia: Update home-page.
Date: Wed, 02 Apr 2025 18:12:48 +0530
[Message part 1 (text/plain, inline)]
Sorry, even as an attachment, ii is failing to send. Could creating a new issue work?

On 1 April 2025 1:24:43 pm IST, "Ludovic Courtès" <ludo <at> gnu.org> wrote:
>Hi,
>
>Sughosha <sughosha <at> disroot.org> skribis:
>
>> I don't know what is wrong with this patch, I am not able to send it with 'git 
>> send-email', the mail is not getting delivered. This is happening only to this 
>> patch. So I am now sending it as an attatchment to this.
>
>I didn’t get the patch here; the attachments are SMTP error logs.
>
>Ludo’.

Sughosha
[Message part 2 (text/html, inline)]

Information forwarded to guix-patches <at> gnu.org:
bug#77023; Package guix-patches. (Tue, 22 Apr 2025 07:05:01 GMT) Full text and rfc822 format available.

Message #44 received at 77023 <at> debbugs.gnu.org (full text, mbox):

From: Maxim Cournoyer <maxim.cournoyer <at> gmail.com>
To: Sughosha <sughosha <at> disroot.org>
Cc: Ludovic Courtès <ludo <at> gnu.org>, 77023 <at> debbugs.gnu.org
Subject: Re: [bug#77023] [PATCH v3 1/3] gnu: readymedia: Update home-page.
Date: Tue, 22 Apr 2025 16:04:14 +0900
Hi Sugosha,

Sughosha <sughosha <at> disroot.org> writes:

> On Tuesday, March 25, 2025 8:16:35 PM GMT+5:30 Ludovic Courtès wrote:
>> Hi,
>> 
>> I think you forgot patch 3/3. :-)
>> 
>> Also, please make sure the series applies above
>> cfe68843a8bf8cded75e3901debc13023d1225b3.
>> 
>> Ludo’.
> I don't know what is wrong with this patch, I am not able to send it with 'git 
> send-email', the mail is not getting delivered. This is happening only to this 
> patch. So I am now sending it as an attatchment to this.

I think there is a problem with the authentication/signing of your email
by your provider (disroot.org), and probably got bounced around too many
times.  At least the Gmail interface marked these as SPAM with the reason
being related to 'email authentication' or similar.

Could you try again?  Another series wouldn't help.  It has to do with
your email provider, most probably.

-- 
Thanks,
Maxim




Information forwarded to andrew <at> trop.in, gabriel <at> erlikon.ch, hako <at> ultrarare.space, janneke <at> gnu.org, ludo <at> gnu.org, maxim.cournoyer <at> gmail.com, tanguy <at> bioneland.org, guix-patches <at> gnu.org:
bug#77023; Package guix-patches. (Sun, 04 May 2025 10:13:01 GMT) Full text and rfc822 format available.

Message #47 received at 77023 <at> debbugs.gnu.org (full text, mbox):

From: Sughosha <sughosha <at> disroot.org>
To: 77023 <at> debbugs.gnu.org
Cc: Sughosha <sughosha <at> disroot.org>
Subject: [PATCH v4] home: services: Add readymedia.
Date: Sun,  4 May 2025 15:41:36 +0530
* gnu/home/services/upnp.scm: New file.
* gnu/local.mk: Register it.
* gnu/services/upnp.scm: Export readymedia-activation and
readymedia-shepherd-service.
(<readymedia-configuration>)[home-service?]: New field.
[cache-directory]: Adjust value depending on 'for-home?'.
[log-directory]: Ditto.
(readymedia-shepherd-service): Adjust 'requirement' and 'start' according to
'home-service?'.
(readymedia-activation): Adjust creating 'media-directories' with permissions
according to 'home-service?'.
* doc/guix.texi (Miscellaneous Home Services): Document Readymedia Service.
(Miscellaneous Services): Add cross-reference.

Change-Id: Id0c7ac2e1c4e17f1efb2d49d98883129d90afc38
---
 doc/guix.texi              | 45 +++++++++++++++++++++++++++++++
 gnu/home/services/upnp.scm | 55 ++++++++++++++++++++++++++++++++++++++
 gnu/local.mk               |  1 +
 gnu/services/upnp.scm      | 49 ++++++++++++++++++++++++---------
 4 files changed, 137 insertions(+), 13 deletions(-)
 create mode 100644 gnu/home/services/upnp.scm

diff --git a/doc/guix.texi b/doc/guix.texi
index 7f796c5fc94..bb48b1ae8ec 100644
--- a/doc/guix.texi
+++ b/doc/guix.texi
@@ -44872,6 +44872,12 @@ Miscellaneous Services
 field is mandatory.  All other fields (such as network ports and the
 server name) come with a predefined default and can be omitted.
 
+@quotation Note
+This service is also available for Guix Home, where it runs directly
+with your user privileges (@pxref{Miscellaneous Home Services,
+@code{home-readymedia-service-type}}).
+@end quotation
+
 @c %start of fragment
 
 @deftp {Data Type} readymedia-configuration
@@ -51149,6 +51155,8 @@ Networking Home Services
 This section lists services somewhat networking-related that you may use
 with Guix Home.
 
+@subheading Syncthing Service
+
 @cindex Syncthing, file synchronization service
 @cindex backup service, Syncthing
 The @code{(gnu home services syncthing)} module provides a service to
@@ -51251,6 +51259,43 @@ Miscellaneous Home Services
           (dicod-configuration @dots{})))
 @end lisp
 
+@subheading ReadyMedia Service
+
+@cindex ReadyMedia, DLNA/UPnP Service
+The @code{(gnu home services upnp)} module provides a service to set up
+the @uref{https://minidlna.sourceforge.net/, ReadyMedia} @acronym{DLNA,
+Digital Living Network Alliance} @acronym{UPnP, Universal Plug and Play}
+media server.
+
+@defvar home-readymedia-service-type
+This is the service type for the @command{minidlnad} daemon; it is the
+Home counterpart of the @code{readymedia-service-type} system service
+(@pxref{Miscellaneous Services, @code{readymedia-service-type}}).  The value
+for this service type is a @code{readymedia-configuration}.
+@end defvar
+
+The service can be used with a @code{readymedia-configuration} wrapped in
+@code{for-home} like this:
+
+@lisp
+(service home-readymedia-service-type
+         (for-home
+          (readymedia-configuration
+            (media-directories
+             (list (readymedia-directory
+                     (path "/path/to/media/audio")
+                     (types '(A)))
+                   (readymedia-directory
+                     (path "/path/to/media/video")
+                     (types '(V)))
+                   (readymedia-directory
+                     (path "/path/to/media/misc")))))))
+@end lisp
+
+For details about @code{readymedia-configuration}, check out the
+documentation of the system service (@pxref{Miscellaneous Services,
+@code{readymedia-service-type}}).
+
 @node Invoking guix home
 @section Invoking @command{guix home}
 
diff --git a/gnu/home/services/upnp.scm b/gnu/home/services/upnp.scm
new file mode 100644
index 00000000000..869c8e0c4a7
--- /dev/null
+++ b/gnu/home/services/upnp.scm
@@ -0,0 +1,55 @@
+;;; GNU Guix --- Functional package management for GNU
+;;; Copyright �� 2025 Sughosha <sughosha <at> disroot.org>
+;;;
+;;; This file is part of GNU Guix.
+;;;
+;;; GNU Guix is free software; you can redistribute it and/or modify it
+;;; under the terms of the GNU General Public License as published by
+;;; the Free Software Foundation; either version 3 of the License, or (at
+;;; your option) any later version.
+;;;
+;;; GNU Guix is distributed in the hope that it will be useful, but
+;;; WITHOUT ANY WARRANTY; without even the implied warranty of
+;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+;;; GNU General Public License for more details.
+;;;
+;;; You should have received a copy of the GNU General Public License
+;;; along with GNU Guix.  If not, see <http://www.gnu.org/licenses/>.
+
+(define-module (gnu home services upnp)
+  #:use-module ((gnu build linux-container) #:select (%namespaces))
+  #:use-module (gnu services)
+  #:use-module (gnu home services)
+  ;; For the 'home-shepherd-service-type' mapping.
+  #:use-module (gnu home services shepherd)
+  #:use-module (gnu services upnp)
+  #:use-module (guix records)
+  #:export (home-readymedia-service-type)
+  #:re-export (readymedia-configuration
+               readymedia-configuration?
+               readymedia-configuration-readymedia
+               readymedia-configuration-port
+               readymedia-configuration-cache-directory
+               readymedia-configuration-extra-config
+               readymedia-configuration-friendly-name
+               readymedia-configuration-log-directory
+               readymedia-configuration-media-directories
+               readymedia-media-directory
+               readymedia-media-directory?
+               readymedia-media-directory-path
+               readymedia-media-directory-types))
+
+(define home-readymedia-service-type
+  (service-type
+   (inherit (system->home-service-type readymedia-service-type))
+   ;; system->home-service-type does not convert special-files-service-type to
+   ;; home-files-service-type, so redefine extensios
+   (extensions
+    (list (service-extension home-shepherd-service-type
+                             (compose list readymedia-shepherd-service))
+          (service-extension home-activation-service-type
+                             readymedia-activation)))
+   (default-value
+    (for-home
+     (readymedia-configuration
+       (media-directories '()))))))
diff --git a/gnu/local.mk b/gnu/local.mk
index e25fcc115be..673d2636c24 100644
--- a/gnu/local.mk
+++ b/gnu/local.mk
@@ -122,6 +122,7 @@ GNU_SYSTEM_MODULES =				\
   %D%/home/services/sway.scm			\
   %D%/home/services/syncthing.scm		\
   %D%/home/services/mcron.scm			\
+  %D%/home/services/upnp.scm			\
   %D%/home/services/utils.scm			\
   %D%/home/services/xdg.scm			\
   %D%/image.scm					\
diff --git a/gnu/services/upnp.scm b/gnu/services/upnp.scm
index 47c32f0a1ef..579378b94a9 100644
--- a/gnu/services/upnp.scm
+++ b/gnu/services/upnp.scm
@@ -50,7 +50,9 @@ (define-module (gnu services upnp)
             readymedia-media-directory-path
             readymedia-media-directory-types
             readymedia-media-directory?
-            readymedia-service-type))
+            readymedia-service-type
+            readymedia-activation
+            readymedia-shepherd-service))
 
 ;;; Commentary:
 ;;;
@@ -72,14 +74,27 @@ (define-record-type* <readymedia-configuration>
   (port readymedia-configuration-port
         (default #f))
   (cache-directory readymedia-configuration-cache-directory
-                   (default %readymedia-default-cache-directory))
+                   (default (if for-home?
+                                (string-append (or (getenv "XDG_CACHE_HOME")
+                                                   (string-append
+                                                    (getenv "HOME") "/.cache"))
+                                               "/readymedia")
+                              %readymedia-default-cache-directory)))
   (log-directory readymedia-configuration-log-directory
-                 (default %readymedia-default-log-directory))
+                 (default (if for-home?
+                              (string-append (or (getenv "XDG_STATE_HOME")
+                                                 (string-append
+                                                  (getenv "HOME")
+                                                  "/.local/state"))
+                                             "/readymedia")
+                            %readymedia-default-log-directory)))
   (friendly-name readymedia-configuration-friendly-name
                  (default #f))
   (media-directories readymedia-configuration-media-directories)
   (extra-config readymedia-configuration-extra-config
-                (default '())))
+                (default '()))
+  (home-service? syncthing-configuration-home-service?
+                 (default for-home?) (innate)))
 
 ;; READYMEDIA-MEDIA-DIR is a record that indicates the path of a media folder
 ;; and the types of media included within it. Allowed individual types are the
@@ -96,9 +111,13 @@ (define-record-type* <readymedia-media-directory>
 (define (readymedia-configuration->config-file config)
   "Return the ReadyMedia/MiniDLNA configuration file corresponding to CONFIG."
   (match-record config <readymedia-configuration>
-    (port friendly-name cache-directory log-directory media-directories extra-config)
+    (port friendly-name cache-directory log-directory media-directories
+     extra-config home-service?)
     (apply mixed-text-file
            "minidlna.conf"
+           (if home-service?
+               (string-append "user=" (number->string (getuid)) "\n")
+               "")
            "db_dir=" cache-directory "\n"
            "log_dir=" log-directory "\n"
            (if friendly-name
@@ -125,12 +144,12 @@ (define (readymedia-configuration->config-file config)
 (define (readymedia-shepherd-service config)
   "Return a least-authority ReadyMedia/MiniDLNA Shepherd service."
   (match-record config <readymedia-configuration>
-    (cache-directory log-directory media-directories)
+    (cache-directory log-directory media-directories home-service?)
     (let ((minidlna-conf (readymedia-configuration->config-file config)))
       (shepherd-service
        (documentation "Run the ReadyMedia/MiniDLNA daemon.")
        (provision '(readymedia))
-       (requirement '(networking user-processes))
+       (requirement (if home-service? '() '(networking user-processes)))
        (start
         #~(make-forkexec-constructor
            (list #$(least-authority-wrapper
@@ -159,8 +178,8 @@ (define (readymedia-shepherd-service config)
                  #$minidlna-conf
                  "-S")
            #:log-file #$(string-append log-directory "/" %readymedia-log-file)
-           #:user #$%readymedia-user-account
-           #:group #$%readymedia-user-group))
+           #:user #$(if home-service? #f %readymedia-user-account)
+           #:group #$(if home-service? #f %readymedia-user-group)))
        (stop #~(make-kill-destructor))))))
 
 (define readymedia-accounts
@@ -178,7 +197,7 @@ (define readymedia-accounts
 (define (readymedia-activation config)
   "Set up directories for ReadyMedia/MiniDLNA."
   (match-record config <readymedia-configuration>
-    (cache-directory log-directory media-directories)
+    (cache-directory log-directory media-directories home-service?)
     (with-imported-modules (source-module-closure '((gnu build activation)))
       #~(begin
           (use-modules (gnu build activation))
@@ -186,14 +205,18 @@ (define (readymedia-activation config)
           (for-each (lambda (directory)
                       (unless (file-exists? directory)
                         (mkdir-p/perms directory
-                                       (getpw #$%readymedia-user-account)
-                                       #o775)))
+                                       (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)
                       (unless (file-exists? directory)
                         (mkdir-p/perms directory
-                                       (getpw #$%readymedia-user-account)
+                                       (getpw #$(if home-service?
+                                                    (getuid)
+                                                    %readymedia-user-account))
                                        #o755)))
                     (list #$cache-directory #$log-directory))))))
 

base-commit: cea6eedfcea2defa526bc58d4fb2085cc8c0cb36
-- 
2.48.1





Information forwarded to guix-patches <at> gnu.org:
bug#77023; Package guix-patches. (Mon, 05 May 2025 15:36:03 GMT) Full text and rfc822 format available.

Message #50 received at 77023 <at> debbugs.gnu.org (full text, mbox):

From: Ludovic Courtès <ludo <at> gnu.org>
To: Sughosha <sughosha <at> disroot.org>
Cc: 77023 <at> debbugs.gnu.org, Maxim Cournoyer <maxim.cournoyer <at> gmail.com>,
 Gabriel Wicki <gabriel <at> erlikon.ch>, Andrew Tropin <andrew <at> trop.in>,
 Hilton Chain <hako <at> ultrarare.space>, Tanguy Le Carrour <tanguy <at> bioneland.org>,
 Janneke Nieuwenhuizen <janneke <at> gnu.org>
Subject: Re: bug#77023: [PATCH 0/3] home: services: Add readymedia.
Date: Mon, 05 May 2025 14:33:29 +0200
[Message part 1 (text/plain, inline)]
Sughosha <sughosha <at> disroot.org> writes:

> * gnu/home/services/upnp.scm: New file.
> * gnu/local.mk: Register it.
> * gnu/services/upnp.scm: Export readymedia-activation and
> readymedia-shepherd-service.
> (<readymedia-configuration>)[home-service?]: New field.
> [cache-directory]: Adjust value depending on 'for-home?'.
> [log-directory]: Ditto.
> (readymedia-shepherd-service): Adjust 'requirement' and 'start' according to
> 'home-service?'.
> (readymedia-activation): Adjust creating 'media-directories' with permissions
> according to 'home-service?'.
> * doc/guix.texi (Miscellaneous Home Services): Document Readymedia Service.
> (Miscellaneous Services): Add cross-reference.
>
> Change-Id: Id0c7ac2e1c4e17f1efb2d49d98883129d90afc38

Hello!  We’re almost there.  While running the system test, I noticed
that something had broken; I also noticed that we were calling ‘getpid’
at build time rather than at run time in the Home case, hence this
patch.

However, there’s still a test failure:

--8<---------------cut here---------------start------------->8---
Test begin:
  test-name: "ReadyMedia service is listening for connections"
  source-file: "/gnu/store/scyy0hybjm1qifpwlmzjhvs1ry28lvnk-readymedia-test-builder"
  source-line: 1
  source-form: (test-assert "ReadyMedia service is listening for connections" (wait-for-tcp-por)
Test end:
  result-kind: fail
  actual-value: #f
  actual-error: (misc-error #f "nobody's listening on port ~S" (("127.0.0.1" 8200)) #f)
--8<---------------cut here---------------end--------------->8---

Could you take a look?

Thanks,
Ludo’.

[Message part 2 (text/x-patch, inline)]
diff --git a/gnu/services/upnp.scm b/gnu/services/upnp.scm
index 579378b94a..363da005f1 100644
--- a/gnu/services/upnp.scm
+++ b/gnu/services/upnp.scm
@@ -33,7 +33,6 @@ (define-module (gnu services upnp)
   #:use-module (ice-9 match)
   #:export (%readymedia-default-cache-directory
             %readymedia-default-log-directory
-            %readymedia-default-port
             %readymedia-log-file
             %readymedia-user-account
             %readymedia-user-group
@@ -206,16 +205,16 @@ (define (readymedia-activation config)
                       (unless (file-exists? directory)
                         (mkdir-p/perms directory
                                        (getpw #$(if home-service?
-                                                    (getuid)
+                                                    #~(getuid)
                                                     %readymedia-user-account))
-                                       (if home-service? #o755 #o775))))
+                                       #$(if home-service? #o755 #o775))))
                     (list #$@(map readymedia-media-directory-path
                                   media-directories)))
           (for-each (lambda (directory)
                       (unless (file-exists? directory)
                         (mkdir-p/perms directory
                                        (getpw #$(if home-service?
-                                                    (getuid)
+                                                    #~(getuid)
                                                     %readymedia-user-account))
                                        #o755)))
                     (list #$cache-directory #$log-directory))))))
diff --git a/gnu/tests/upnp.scm b/gnu/tests/upnp.scm
index e4bce30d89..0224557f40 100644
--- a/gnu/tests/upnp.scm
+++ b/gnu/tests/upnp.scm
@@ -38,6 +38,7 @@ (define %readymedia-default-port 8200)
 (define %readymedia-media-directory "/media")
 (define %readymedia-configuration-test
   (readymedia-configuration
+   (port %readymedia-default-port)
    (media-directories
     (list (readymedia-media-directory (path %readymedia-media-directory)
                                       (types '(A V)))))))

Reply sent to Ludovic Courtès <ludo <at> gnu.org>:
You have taken responsibility. (Mon, 05 May 2025 15:36:06 GMT) Full text and rfc822 format available.

Notification sent to Sughosha <sughosha <at> disroot.org>:
bug acknowledged by developer. (Mon, 05 May 2025 15:36:07 GMT) Full text and rfc822 format available.

Message #55 received at 77023-done <at> debbugs.gnu.org (full text, mbox):

From: Ludovic Courtès <ludo <at> gnu.org>
To: Sughosha <sughosha <at> disroot.org>
Cc: Tanguy Le Carrour <tanguy <at> bioneland.org>,
 Maxim Cournoyer <maxim.cournoyer <at> gmail.com>,
 Gabriel Wicki <gabriel <at> erlikon.ch>, Andrew Tropin <andrew <at> trop.in>,
 Hilton Chain <hako <at> ultrarare.space>, 77023-done <at> debbugs.gnu.org,
 Janneke Nieuwenhuizen <janneke <at> gnu.org>
Subject: Re: [bug#77023] [PATCH v4] home: services: Add readymedia.
Date: Mon, 05 May 2025 11:44:03 +0200
Hi,

Sughosha <sughosha <at> disroot.org> writes:

> * gnu/home/services/upnp.scm: New file.
> * gnu/local.mk: Register it.
> * gnu/services/upnp.scm: Export readymedia-activation and
> readymedia-shepherd-service.
> (<readymedia-configuration>)[home-service?]: New field.
> [cache-directory]: Adjust value depending on 'for-home?'.
> [log-directory]: Ditto.
> (readymedia-shepherd-service): Adjust 'requirement' and 'start' according to
> 'home-service?'.
> (readymedia-activation): Adjust creating 'media-directories' with permissions
> according to 'home-service?'.
> * doc/guix.texi (Miscellaneous Home Services): Document Readymedia Service.
> (Miscellaneous Services): Add cross-reference.
>
> Change-Id: Id0c7ac2e1c4e17f1efb2d49d98883129d90afc38

Finally applied, thanks!

Ludo’.




Information forwarded to andrew <at> trop.in, gabriel <at> erlikon.ch, hako <at> ultrarare.space, janneke <at> gnu.org, ludo <at> gnu.org, maxim.cournoyer <at> gmail.com, tanguy <at> bioneland.org, guix-patches <at> gnu.org:
bug#77023; Package guix-patches. (Sat, 10 May 2025 14:37:02 GMT) Full text and rfc822 format available.

Message #58 received at 77023 <at> debbugs.gnu.org (full text, mbox):

From: Sughosha <sughosha <at> disroot.org>
To: 77023 <at> debbugs.gnu.org
Cc: Sughosha <sughosha <at> disroot.org>
Subject: [PATCH v5] home: services: Add readymedia.
Date: Sat, 10 May 2025 20:04:58 +0530
* gnu/home/services/upnp.scm: New file.
* gnu/local.mk: Register it.
* gnu/services/upnp.scm: Export readymedia-activation and
readymedia-shepherd-service.
(<readymedia-configuration>)[home-service?]: New field.
[cache-directory]: Adjust value depending on 'for-home?'.
[log-directory]: Ditto.
(readymedia-shepherd-service): Adjust 'requirement' and 'start' according to
'home-service?'.
(readymedia-activation): Adjust creating 'media-directories' with permissions
according to 'home-service?'.
* gnu/tests/upnp.scm (%readymedia-configuration-test): Configure port with
%readymedia-default-port.
* doc/guix.texi (Miscellaneous Home Services): Document Readymedia Service.
(Miscellaneous Services): Add cross-reference.

Change-Id: I5c48595d84a815d98e03c7f68a716f048903720c
---
 doc/guix.texi              | 45 +++++++++++++++++++++++++++++++
 gnu/home/services/upnp.scm | 55 ++++++++++++++++++++++++++++++++++++++
 gnu/local.mk               |  1 +
 gnu/services/upnp.scm      | 50 ++++++++++++++++++++++++----------
 gnu/tests/upnp.scm         |  1 +
 5 files changed, 138 insertions(+), 14 deletions(-)
 create mode 100644 gnu/home/services/upnp.scm

diff --git a/doc/guix.texi b/doc/guix.texi
index 7f796c5fc94..bb48b1ae8ec 100644
--- a/doc/guix.texi
+++ b/doc/guix.texi
@@ -44872,6 +44872,12 @@ Miscellaneous Services
 field is mandatory.  All other fields (such as network ports and the
 server name) come with a predefined default and can be omitted.
 
+@quotation Note
+This service is also available for Guix Home, where it runs directly
+with your user privileges (@pxref{Miscellaneous Home Services,
+@code{home-readymedia-service-type}}).
+@end quotation
+
 @c %start of fragment
 
 @deftp {Data Type} readymedia-configuration
@@ -51149,6 +51155,8 @@ Networking Home Services
 This section lists services somewhat networking-related that you may use
 with Guix Home.
 
+@subheading Syncthing Service
+
 @cindex Syncthing, file synchronization service
 @cindex backup service, Syncthing
 The @code{(gnu home services syncthing)} module provides a service to
@@ -51251,6 +51259,43 @@ Miscellaneous Home Services
           (dicod-configuration @dots{})))
 @end lisp
 
+@subheading ReadyMedia Service
+
+@cindex ReadyMedia, DLNA/UPnP Service
+The @code{(gnu home services upnp)} module provides a service to set up
+the @uref{https://minidlna.sourceforge.net/, ReadyMedia} @acronym{DLNA,
+Digital Living Network Alliance} @acronym{UPnP, Universal Plug and Play}
+media server.
+
+@defvar home-readymedia-service-type
+This is the service type for the @command{minidlnad} daemon; it is the
+Home counterpart of the @code{readymedia-service-type} system service
+(@pxref{Miscellaneous Services, @code{readymedia-service-type}}).  The value
+for this service type is a @code{readymedia-configuration}.
+@end defvar
+
+The service can be used with a @code{readymedia-configuration} wrapped in
+@code{for-home} like this:
+
+@lisp
+(service home-readymedia-service-type
+         (for-home
+          (readymedia-configuration
+            (media-directories
+             (list (readymedia-directory
+                     (path "/path/to/media/audio")
+                     (types '(A)))
+                   (readymedia-directory
+                     (path "/path/to/media/video")
+                     (types '(V)))
+                   (readymedia-directory
+                     (path "/path/to/media/misc")))))))
+@end lisp
+
+For details about @code{readymedia-configuration}, check out the
+documentation of the system service (@pxref{Miscellaneous Services,
+@code{readymedia-service-type}}).
+
 @node Invoking guix home
 @section Invoking @command{guix home}
 
diff --git a/gnu/home/services/upnp.scm b/gnu/home/services/upnp.scm
new file mode 100644
index 00000000000..869c8e0c4a7
--- /dev/null
+++ b/gnu/home/services/upnp.scm
@@ -0,0 +1,55 @@
+;;; GNU Guix --- Functional package management for GNU
+;;; Copyright �� 2025 Sughosha <sughosha <at> disroot.org>
+;;;
+;;; This file is part of GNU Guix.
+;;;
+;;; GNU Guix is free software; you can redistribute it and/or modify it
+;;; under the terms of the GNU General Public License as published by
+;;; the Free Software Foundation; either version 3 of the License, or (at
+;;; your option) any later version.
+;;;
+;;; GNU Guix is distributed in the hope that it will be useful, but
+;;; WITHOUT ANY WARRANTY; without even the implied warranty of
+;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+;;; GNU General Public License for more details.
+;;;
+;;; You should have received a copy of the GNU General Public License
+;;; along with GNU Guix.  If not, see <http://www.gnu.org/licenses/>.
+
+(define-module (gnu home services upnp)
+  #:use-module ((gnu build linux-container) #:select (%namespaces))
+  #:use-module (gnu services)
+  #:use-module (gnu home services)
+  ;; For the 'home-shepherd-service-type' mapping.
+  #:use-module (gnu home services shepherd)
+  #:use-module (gnu services upnp)
+  #:use-module (guix records)
+  #:export (home-readymedia-service-type)
+  #:re-export (readymedia-configuration
+               readymedia-configuration?
+               readymedia-configuration-readymedia
+               readymedia-configuration-port
+               readymedia-configuration-cache-directory
+               readymedia-configuration-extra-config
+               readymedia-configuration-friendly-name
+               readymedia-configuration-log-directory
+               readymedia-configuration-media-directories
+               readymedia-media-directory
+               readymedia-media-directory?
+               readymedia-media-directory-path
+               readymedia-media-directory-types))
+
+(define home-readymedia-service-type
+  (service-type
+   (inherit (system->home-service-type readymedia-service-type))
+   ;; system->home-service-type does not convert special-files-service-type to
+   ;; home-files-service-type, so redefine extensios
+   (extensions
+    (list (service-extension home-shepherd-service-type
+                             (compose list readymedia-shepherd-service))
+          (service-extension home-activation-service-type
+                             readymedia-activation)))
+   (default-value
+    (for-home
+     (readymedia-configuration
+       (media-directories '()))))))
diff --git a/gnu/local.mk b/gnu/local.mk
index e25fcc115be..673d2636c24 100644
--- a/gnu/local.mk
+++ b/gnu/local.mk
@@ -122,6 +122,7 @@ GNU_SYSTEM_MODULES =				\
   %D%/home/services/sway.scm			\
   %D%/home/services/syncthing.scm		\
   %D%/home/services/mcron.scm			\
+  %D%/home/services/upnp.scm			\
   %D%/home/services/utils.scm			\
   %D%/home/services/xdg.scm			\
   %D%/image.scm					\
diff --git a/gnu/services/upnp.scm b/gnu/services/upnp.scm
index 47c32f0a1ef..363da005f1e 100644
--- a/gnu/services/upnp.scm
+++ b/gnu/services/upnp.scm
@@ -33,7 +33,6 @@ (define-module (gnu services upnp)
   #:use-module (ice-9 match)
   #:export (%readymedia-default-cache-directory
             %readymedia-default-log-directory
-            %readymedia-default-port
             %readymedia-log-file
             %readymedia-user-account
             %readymedia-user-group
@@ -50,7 +49,9 @@ (define-module (gnu services upnp)
             readymedia-media-directory-path
             readymedia-media-directory-types
             readymedia-media-directory?
-            readymedia-service-type))
+            readymedia-service-type
+            readymedia-activation
+            readymedia-shepherd-service))
 
 ;;; Commentary:
 ;;;
@@ -72,14 +73,27 @@ (define-record-type* <readymedia-configuration>
   (port readymedia-configuration-port
         (default #f))
   (cache-directory readymedia-configuration-cache-directory
-                   (default %readymedia-default-cache-directory))
+                   (default (if for-home?
+                                (string-append (or (getenv "XDG_CACHE_HOME")
+                                                   (string-append
+                                                    (getenv "HOME") "/.cache"))
+                                               "/readymedia")
+                              %readymedia-default-cache-directory)))
   (log-directory readymedia-configuration-log-directory
-                 (default %readymedia-default-log-directory))
+                 (default (if for-home?
+                              (string-append (or (getenv "XDG_STATE_HOME")
+                                                 (string-append
+                                                  (getenv "HOME")
+                                                  "/.local/state"))
+                                             "/readymedia")
+                            %readymedia-default-log-directory)))
   (friendly-name readymedia-configuration-friendly-name
                  (default #f))
   (media-directories readymedia-configuration-media-directories)
   (extra-config readymedia-configuration-extra-config
-                (default '())))
+                (default '()))
+  (home-service? syncthing-configuration-home-service?
+                 (default for-home?) (innate)))
 
 ;; READYMEDIA-MEDIA-DIR is a record that indicates the path of a media folder
 ;; and the types of media included within it. Allowed individual types are the
@@ -96,9 +110,13 @@ (define-record-type* <readymedia-media-directory>
 (define (readymedia-configuration->config-file config)
   "Return the ReadyMedia/MiniDLNA configuration file corresponding to CONFIG."
   (match-record config <readymedia-configuration>
-    (port friendly-name cache-directory log-directory media-directories extra-config)
+    (port friendly-name cache-directory log-directory media-directories
+     extra-config home-service?)
     (apply mixed-text-file
            "minidlna.conf"
+           (if home-service?
+               (string-append "user=" (number->string (getuid)) "\n")
+               "")
            "db_dir=" cache-directory "\n"
            "log_dir=" log-directory "\n"
            (if friendly-name
@@ -125,12 +143,12 @@ (define (readymedia-configuration->config-file config)
 (define (readymedia-shepherd-service config)
   "Return a least-authority ReadyMedia/MiniDLNA Shepherd service."
   (match-record config <readymedia-configuration>
-    (cache-directory log-directory media-directories)
+    (cache-directory log-directory media-directories home-service?)
     (let ((minidlna-conf (readymedia-configuration->config-file config)))
       (shepherd-service
        (documentation "Run the ReadyMedia/MiniDLNA daemon.")
        (provision '(readymedia))
-       (requirement '(networking user-processes))
+       (requirement (if home-service? '() '(networking user-processes)))
        (start
         #~(make-forkexec-constructor
            (list #$(least-authority-wrapper
@@ -159,8 +177,8 @@ (define (readymedia-shepherd-service config)
                  #$minidlna-conf
                  "-S")
            #:log-file #$(string-append log-directory "/" %readymedia-log-file)
-           #:user #$%readymedia-user-account
-           #:group #$%readymedia-user-group))
+           #:user #$(if home-service? #f %readymedia-user-account)
+           #:group #$(if home-service? #f %readymedia-user-group)))
        (stop #~(make-kill-destructor))))))
 
 (define readymedia-accounts
@@ -178,7 +196,7 @@ (define readymedia-accounts
 (define (readymedia-activation config)
   "Set up directories for ReadyMedia/MiniDLNA."
   (match-record config <readymedia-configuration>
-    (cache-directory log-directory media-directories)
+    (cache-directory log-directory media-directories home-service?)
     (with-imported-modules (source-module-closure '((gnu build activation)))
       #~(begin
           (use-modules (gnu build activation))
@@ -186,14 +204,18 @@ (define (readymedia-activation config)
           (for-each (lambda (directory)
                       (unless (file-exists? directory)
                         (mkdir-p/perms directory
-                                       (getpw #$%readymedia-user-account)
-                                       #o775)))
+                                       (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)
                       (unless (file-exists? directory)
                         (mkdir-p/perms directory
-                                       (getpw #$%readymedia-user-account)
+                                       (getpw #$(if home-service?
+                                                    #~(getuid)
+                                                    %readymedia-user-account))
                                        #o755)))
                     (list #$cache-directory #$log-directory))))))
 
diff --git a/gnu/tests/upnp.scm b/gnu/tests/upnp.scm
index e4bce30d89d..0224557f401 100644
--- a/gnu/tests/upnp.scm
+++ b/gnu/tests/upnp.scm
@@ -38,6 +38,7 @@ (define %readymedia-default-port 8200)
 (define %readymedia-media-directory "/media")
 (define %readymedia-configuration-test
   (readymedia-configuration
+   (port %readymedia-default-port)
    (media-directories
     (list (readymedia-media-directory (path %readymedia-media-directory)
                                       (types '(A V)))))))

base-commit: cea6eedfcea2defa526bc58d4fb2085cc8c0cb36
-- 
2.49.0





Did not alter fixed versions and reopened. Request was from Debbugs Internal Request <help-debbugs <at> gnu.org> to internal_control <at> debbugs.gnu.org. (Wed, 14 May 2025 08:03:01 GMT) Full text and rfc822 format available.

Information forwarded to guix-patches <at> gnu.org:
bug#77023; Package guix-patches. (Wed, 14 May 2025 09:29:02 GMT) Full text and rfc822 format available.

Message #63 received at 77023 <at> debbugs.gnu.org (full text, mbox):

From: Sughosha <sughosha <at> disroot.org>
To: Ludovic Courtès <ludo <at> gnu.org>
Cc: 77023 <at> debbugs.gnu.org, Maxim Cournoyer <maxim.cournoyer <at> gmail.com>,
 Gabriel Wicki <gabriel <at> erlikon.ch>, Andrew Tropin <andrew <at> trop.in>,
 Hilton Chain <hako <at> ultrarare.space>, Tanguy Le Carrour <tanguy <at> bioneland.org>,
 Janneke Nieuwenhuizen <janneke <at> gnu.org>
Subject: Re: bug#77023: [PATCH 0/3] home: services: Add readymedia.
Date: Wed, 14 May 2025 14:58:28 +0530
[Message part 1 (text/plain, inline)]
On Monday, May 5, 2025 6:03:29 PM GMT+5:30 Ludovic Courtès wrote:
> Sughosha <sughosha <at> disroot.org> writes:
> > * gnu/home/services/upnp.scm: New file.
> > * gnu/local.mk: Register it.
> > * gnu/services/upnp.scm: Export readymedia-activation and
> > readymedia-shepherd-service.
> > (<readymedia-configuration>)[home-service?]: New field.
> > [cache-directory]: Adjust value depending on 'for-home?'.
> > [log-directory]: Ditto.
> > (readymedia-shepherd-service): Adjust 'requirement' and 'start' according
> > to 'home-service?'.
> > (readymedia-activation): Adjust creating 'media-directories' with
> > permissions according to 'home-service?'.
> > * doc/guix.texi (Miscellaneous Home Services): Document Readymedia
> > Service.
> > (Miscellaneous Services): Add cross-reference.
> > 
> > Change-Id: Id0c7ac2e1c4e17f1efb2d49d98883129d90afc38
> 
> Hello!  We’re almost there.  While running the system test, I noticed
> that something had broken; I also noticed that we were calling ‘getpid’
> at build time rather than at run time in the Home case, hence this
> patch.
> 
> However, there’s still a test failure:
> 
> --8<---------------cut here---------------start------------->8---
> Test begin:
>   test-name: "ReadyMedia service is listening for connections"
>   source-file:
> "/gnu/store/scyy0hybjm1qifpwlmzjhvs1ry28lvnk-readymedia-test-builder"
> source-line: 1
>   source-form: (test-assert "ReadyMedia service is listening for
> connections" (wait-for-tcp-por) Test end:
>   result-kind: fail
>   actual-value: #f
>   actual-error: (misc-error #f "nobody's listening on port ~S" (("127.0.0.1"
> 8200)) #f) --8<---------------cut
> here---------------end--------------->8---
> 
> Could you take a look?
> 
> Thanks,
> Ludo’.

I have sent the v5 patch, does it pass this test? I don't know how to run this 
test.

-- 
Sughosha
[signature.asc (application/pgp-signature, inline)]

Information forwarded to guix-patches <at> gnu.org:
bug#77023; Package guix-patches. (Wed, 14 May 2025 10:08:02 GMT) Full text and rfc822 format available.

Message #66 received at 77023 <at> debbugs.gnu.org (full text, mbox):

From: Ludovic Courtès <ludo <at> gnu.org>
To: Sughosha <sughosha <at> disroot.org>
Cc: 77023 <at> debbugs.gnu.org, Maxim Cournoyer <maxim.cournoyer <at> gmail.com>,
 Gabriel Wicki <gabriel <at> erlikon.ch>, Andrew Tropin <andrew <at> trop.in>,
 Hilton Chain <hako <at> ultrarare.space>, Tanguy Le Carrour <tanguy <at> bioneland.org>,
 Janneke Nieuwenhuizen <janneke <at> gnu.org>
Subject: Re: bug#77023: [PATCH 0/3] home: services: Add readymedia.
Date: Wed, 14 May 2025 11:49:35 +0200
Hi,

Sughosha <sughosha <at> disroot.org> writes:

> I have sent the v5 patch, does it pass this test? I don't know how to run this 
> test.

You can run “make check-system TESTS=readymedia”.

See
<https://guix.gnu.org/manual/devel/en/html_node/Running-the-Test-Suite.html>.

Ludo’.




Information forwarded to guix-patches <at> gnu.org:
bug#77023; Package guix-patches. (Wed, 14 May 2025 10:39:02 GMT) Full text and rfc822 format available.

Message #69 received at 77023 <at> debbugs.gnu.org (full text, mbox):

From: Sughosha <sughosha <at> disroot.org>
To: Ludovic Courtès <ludo <at> gnu.org>
Cc: 77023 <at> debbugs.gnu.org, Maxim Cournoyer <maxim.cournoyer <at> gmail.com>,
 Gabriel Wicki <gabriel <at> erlikon.ch>, Andrew Tropin <andrew <at> trop.in>,
 Hilton Chain <hako <at> ultrarare.space>, Tanguy Le Carrour <tanguy <at> bioneland.org>,
 Janneke Nieuwenhuizen <janneke <at> gnu.org>
Subject: Re: bug#77023: [PATCH 0/3] home: services: Add readymedia.
Date: Wed, 14 May 2025 16:07:52 +0530
[Message part 1 (text/plain, inline)]
On Wednesday, May 14, 2025 3:19:35 PM GMT+5:30 Ludovic Courtès wrote:
> Hi,
> 
> Sughosha <sughosha <at> disroot.org> writes:
> > I have sent the v5 patch, does it pass this test? I don't know how to run
> > this test.
> 
> You can run “make check-system TESTS=readymedia”.
> 
> See
> <https://guix.gnu.org/manual/devel/en/html_node/Running-the-Test-Suite.html>
> .
> 
> Ludo’.

The test passed successfully, with the v5 patch that I sent above.

-- 
Sughosha
[signature.asc (application/pgp-signature, inline)]

Information forwarded to guix-patches <at> gnu.org:
bug#77023; Package guix-patches. (Wed, 14 May 2025 13:59:02 GMT) Full text and rfc822 format available.

Message #72 received at 77023 <at> debbugs.gnu.org (full text, mbox):

From: Maxim Cournoyer <maxim.cournoyer <at> gmail.com>
To: Sughosha <sughosha <at> disroot.org>
Cc: 77023 <at> debbugs.gnu.org, Ludovic Courtès <ludo <at> gnu.org>,
 Gabriel Wicki <gabriel <at> erlikon.ch>, Andrew Tropin <andrew <at> trop.in>,
 Hilton Chain <hako <at> ultrarare.space>, Tanguy Le Carrour <tanguy <at> bioneland.org>,
 Janneke Nieuwenhuizen <janneke <at> gnu.org>
Subject: Re: [bug#77023] [PATCH 0/3] home: services: Add readymedia.
Date: Wed, 14 May 2025 22:58:33 +0900
Hi,

Sughosha <sughosha <at> disroot.org> writes:

> On Wednesday, May 14, 2025 3:19:35 PM GMT+5:30 Ludovic Courtès wrote:
>> Hi,
>> 
>> Sughosha <sughosha <at> disroot.org> writes:
>> > I have sent the v5 patch, does it pass this test? I don't know how to run
>> > this test.
>> 
>> You can run “make check-system TESTS=readymedia”.
>> 
>> See
>> <https://guix.gnu.org/manual/devel/en/html_node/Running-the-Test-Suite.html>
>> .
>> 
>> Ludo’.
>
> The test passed successfully, with the v5 patch that I sent above.

It didn't for me, I got:

--8<---------------cut here---------------start------------->8---
Test begin:
  test-name: "ReadyMedia service is listening for connections"
  source-file: "/gnu/store/jp9x56qq0dalb01nh61l6zv1w8vss4rm-readymedia-test-builder"
  source-line: 1
  source-form: (test-assert "ReadyMedia service is listening for connections" (wait-for-tcp-port 8200 marionette))
Test end:
  result-kind: fail
  actual-value: #f
  actual-error: (misc-error #f "nobody's listening on port ~S" (("127.0.0.1" 8200)) #f)
Group end: readymedia
# of expected passes      11
# of unexpected failures  1
--8<---------------cut here---------------end--------------->8---

-- 
Thanks,
Maxim




Added tag(s) moreinfo. Request was from Maxim Cournoyer <maxim.cournoyer <at> gmail.com> to control <at> debbugs.gnu.org. (Wed, 14 May 2025 14:00:03 GMT) Full text and rfc822 format available.

Information forwarded to guix-patches <at> gnu.org:
bug#77023; Package guix-patches. (Thu, 15 May 2025 02:51:01 GMT) Full text and rfc822 format available.

Message #77 received at 77023 <at> debbugs.gnu.org (full text, mbox):

From: Sughosha <sughosha <at> disroot.org>
To: Maxim Cournoyer <maxim.cournoyer <at> gmail.com>
Cc: 77023 <at> debbugs.gnu.org, Ludovic Courtès <ludo <at> gnu.org>,
 Gabriel Wicki <gabriel <at> erlikon.ch>, Andrew Tropin <andrew <at> trop.in>,
 Hilton Chain <hako <at> ultrarare.space>, Tanguy Le Carrour <tanguy <at> bioneland.org>,
 Janneke Nieuwenhuizen <janneke <at> gnu.org>
Subject: Re: [bug#77023] [PATCH 0/3] home: services: Add readymedia.
Date: Thu, 15 May 2025 08:20:36 +0530
[Message part 1 (text/plain, inline)]
On Wednesday, May 14, 2025 7:28:33 PM GMT+5:30 Maxim Cournoyer wrote:
> Hi,
> 
> Sughosha <sughosha <at> disroot.org> writes:
> > On Wednesday, May 14, 2025 3:19:35 PM GMT+5:30 Ludovic Courtès wrote:
> >> Hi,
> >> 
> >> Sughosha <sughosha <at> disroot.org> writes:
> >> > I have sent the v5 patch, does it pass this test? I don't know how to
> >> > run
> >> > this test.
> >> 
> >> You can run “make check-system TESTS=readymedia”.
> >> 
> >> See
> >> <https://guix.gnu.org/manual/devel/en/html_node/Running-the-Test-Suite.ht
> >> ml> .
> >> 
> >> Ludo’.
> > 
> > The test passed successfully, with the v5 patch that I sent above.
> 
> It didn't for me, I got:
> 
> --8<---------------cut here---------------start------------->8---
> Test begin:
>   test-name: "ReadyMedia service is listening for connections"
>   source-file:
> "/gnu/store/jp9x56qq0dalb01nh61l6zv1w8vss4rm-readymedia-test-builder"
> source-line: 1
>   source-form: (test-assert "ReadyMedia service is listening for
> connections" (wait-for-tcp-port 8200 marionette)) Test end:
>   result-kind: fail
>   actual-value: #f
>   actual-error: (misc-error #f "nobody's listening on port ~S" (("127.0.0.1"
> 8200)) #f) Group end: readymedia
> # of expected passes      11
> # of unexpected failures  1
> --8<---------------cut here---------------end--------------->8---

I don't know why you are getting this error. I tested it again and it passed. 
The attatchment contains the log.

-- 
Sughosha
[readymedia.log (text/x-log, attachment)]
[signature.asc (application/pgp-signature, inline)]

Information forwarded to guix-patches <at> gnu.org:
bug#77023; Package guix-patches. (Thu, 15 May 2025 04:53:02 GMT) Full text and rfc822 format available.

Message #80 received at 77023 <at> debbugs.gnu.org (full text, mbox):

From: Maxim Cournoyer <maxim.cournoyer <at> gmail.com>
To: Sughosha <sughosha <at> disroot.org>
Cc: 77023 <at> debbugs.gnu.org, Ludovic Courtès <ludo <at> gnu.org>,
 Gabriel Wicki <gabriel <at> erlikon.ch>, Andrew Tropin <andrew <at> trop.in>,
 Hilton Chain <hako <at> ultrarare.space>, Tanguy Le Carrour <tanguy <at> bioneland.org>,
 Janneke Nieuwenhuizen <janneke <at> gnu.org>
Subject: Re: [bug#77023] [PATCH 0/3] home: services: Add readymedia.
Date: Thu, 15 May 2025 13:52:25 +0900
Hi,

Sughosha <sughosha <at> disroot.org> writes:

[...]

>> --8<---------------cut here---------------start------------->8---
>> Test begin:
>>   test-name: "ReadyMedia service is listening for connections"
>>   source-file:
>> "/gnu/store/jp9x56qq0dalb01nh61l6zv1w8vss4rm-readymedia-test-builder"
>> source-line: 1
>>   source-form: (test-assert "ReadyMedia service is listening for
>> connections" (wait-for-tcp-port 8200 marionette)) Test end:
>>   result-kind: fail
>>   actual-value: #f
>>   actual-error: (misc-error #f "nobody's listening on port ~S" (("127.0.0.1"
>> 8200)) #f) Group end: readymedia
>> # of expected passes      11
>> # of unexpected failures  1
>> --8<---------------cut here---------------end--------------->8---
>
> I don't know why you are getting this error. I tested it again and it passed. 
> The attatchment contains the log.

Actually, even before your change is applied, the test is failing.

It seems the least-authority-wrapper doesn't expose everything needed;
at first it was failing to start because it couldn't write to
/var/run/minidlna/minidlna.pid, so I exopsed /var/run like so:

--8<---------------cut here---------------start------------->8---
modified   gnu/services/upnp.scm
@@ -167,6 +167,10 @@ (define (readymedia-shepherd-service config)
                            (file-system-mapping
                             (source minidlna-conf)
                             (target source))
+                           (file-system-mapping
+                            (source "/var/run")
+                            (target source)
+                            (writable? #t))
                            (map (lambda (directory)
                                   (file-system-mapping
                                    (source (readymedia-media-directory-path directory))
--8<---------------cut here---------------end--------------->8---

Now, from the VM, I get:

--8<---------------cut here---------------start------------->8---
"/gnu/store/18d6ifs8j3ggb4zrkxchxn9pnk7795g4-minidlna" "-f" "/gnu/store/1b3szxs7ibivbv1bqmh5c0m5gk5ngv3b-minidlna.conf" "-S"

minidlna.c:520: warn: Unset locale
minidlna.c:1134: warn: Starting MiniDLNA version 1.3.3.
minidlna.c:331: fatal: ERROR: Failed to open sqlite database!  Exiting...
root <at> komputilo ~# echo $?
255
--8<---------------cut here---------------end--------------->8---

Any idea?  It should be reproducible on your side, as long as you rebase
your branch on current master, perhaps.  I tested with commit 7b73f02c38d.

-- 
Thanks,
Maxim




Information forwarded to guix-patches <at> gnu.org:
bug#77023; Package guix-patches. (Thu, 15 May 2025 06:47:01 GMT) Full text and rfc822 format available.

Message #83 received at 77023 <at> debbugs.gnu.org (full text, mbox):

From: Maxim Cournoyer <maxim.cournoyer <at> gmail.com>
To: Sughosha <sughosha <at> disroot.org>
Cc: 77023 <at> debbugs.gnu.org, Ludovic Courtès <ludo <at> gnu.org>,
 Gabriel Wicki <gabriel <at> erlikon.ch>, Andrew Tropin <andrew <at> trop.in>,
 Hilton Chain <hako <at> ultrarare.space>, Tanguy Le Carrour <tanguy <at> bioneland.org>,
 Janneke Nieuwenhuizen <janneke <at> gnu.org>
Subject: Re: [bug#77023] [PATCH 0/3] home: services: Add readymedia.
Date: Thu, 15 May 2025 15:46:18 +0900
Hi,

Actually, it seems the root issue may be related to bug#78356.  When
looking at /var/log/readymedia/minidlna.log we see:


--8<---------------cut here---------------start------------->8---
2025-05-15 08:22:27 In gnu/build/linux-container.scm:
...skipping...
2025-05-15 08:22:27    476:16  3 (_ "/tmp/guix-directory.w1REZ6")
2025-05-15 08:22:27      62:6  2 (call-with-clean-exit #<procedure 7fa0ff7c2e80 at gnu/b?>)
2025-05-15 08:22:27    321:20  1 (_)
2025-05-15 08:22:27 In guix/build/syscalls.scm:
2025-05-15 08:22:27   1231:10  0 (_ 268566528)
2025-05-15 08:22:27 
2025-05-15 08:22:27 guix/build/syscalls.scm:1231:10: In procedure unshare: 268566528: Invalid argument
2025-05-15 08:22:28 Backtrace:
2025-05-15 08:22:28            4 (primitive-load "/gnu/store/4h68sswscz96wk47724bfqfrq9n?")
2025-05-15 08:22:28 In ice-9/eval.scm:
2025-05-15 08:22:28    191:35  3 (_ _)
2025-05-15 08:22:28 In gnu/build/linux-container.scm:
2025-05-15 08:22:28     368:8  2 (call-with-temporary-directory #<procedure 7fa0ff7df3f0?>)
2025-05-15 08:22:28     485:7  1 (_ "/tmp/guix-directory.w1REZ6")
2025-05-15 08:22:28 In unknown file:
2025-05-15 08:22:28            0 (waitpid #f #<undefined>)
2025-05-15 08:22:28 
2025-05-15 08:22:28 ERROR: In procedure waitpid:
2025-05-15 08:22:28 Wrong type (expecting exact integer): #f
--8<---------------cut here---------------end--------------->8---


Which appears to share the same `unshare' issue as seen in bug#78356.

-- 
Thanks,
Maxim




Reply sent to Ludovic Courtès <ludo <at> gnu.org>:
You have taken responsibility. (Sun, 18 May 2025 21:04:05 GMT) Full text and rfc822 format available.

Notification sent to Sughosha <sughosha <at> disroot.org>:
bug acknowledged by developer. (Sun, 18 May 2025 21:04:05 GMT) Full text and rfc822 format available.

Message #88 received at 77023-done <at> debbugs.gnu.org (full text, mbox):

From: Ludovic Courtès <ludo <at> gnu.org>
To: Sughosha <sughosha <at> disroot.org>
Cc: Tanguy Le Carrour <tanguy <at> bioneland.org>,
 Maxim Cournoyer <maxim.cournoyer <at> gmail.com>,
 Gabriel Wicki <gabriel <at> erlikon.ch>, Andrew Tropin <andrew <at> trop.in>,
 Hilton Chain <hako <at> ultrarare.space>, 77023-done <at> debbugs.gnu.org,
 Janneke Nieuwenhuizen <janneke <at> gnu.org>
Subject: Re: [bug#77023] [PATCH v5] home: services: Add readymedia.
Date: Sun, 18 May 2025 22:16:51 +0200
Hi Sughosha,

Sughosha <sughosha <at> disroot.org> writes:

> * gnu/home/services/upnp.scm: New file.
> * gnu/local.mk: Register it.
> * gnu/services/upnp.scm: Export readymedia-activation and
> readymedia-shepherd-service.
> (<readymedia-configuration>)[home-service?]: New field.
> [cache-directory]: Adjust value depending on 'for-home?'.
> [log-directory]: Ditto.
> (readymedia-shepherd-service): Adjust 'requirement' and 'start' according to
> 'home-service?'.
> (readymedia-activation): Adjust creating 'media-directories' with permissions
> according to 'home-service?'.
> * gnu/tests/upnp.scm (%readymedia-configuration-test): Configure port with
> %readymedia-default-port.
> * doc/guix.texi (Miscellaneous Home Services): Document Readymedia Service.
> (Miscellaneous Services): Add cross-reference.
>
> Change-Id: I5c48595d84a815d98e03c7f68a716f048903720c

Finally applied, thanks!

The system test passes, but it fails once every two runs or so.  Could
you take look?

However, I do not see the ‘unshare’ issue that Maxim was reporting: I
double-checked by running the test VM manually, and here’s what I could
see:

--8<---------------cut here---------------start------------->8---
root <at> komputilo ~# herd status readymedia
herd status readymedia
● Status of readymedia:
  It is running since 10:12:32 PM (15 seconds ago).
  Main PID: 145
  Command: /gnu/store/39m4bp93cc65h8i60if803hcfjw5jzyj-minidlna -f /gnu/store/x8vqpc3yqbblm7wbmg0798vvl0mj2rn6-minidlna.conf -S
  It is enabled.
  Provides: readymedia
  Requires: networking user-processes
  Will be respawned.
  Log file: /var/log/readymedia/minidlna.log

Recent messages (use '-n' to view more or less):
  2025-05-18 22:12:33 scanner.c:731: warn: Scanning /media
  2025-05-18 22:12:33 scanner.c:820: warn: Scanning /media finished (0 files)!
  2025-05-18 22:12:33 playlist.c:135: warn: Parsing playlists...
  2025-05-18 22:12:33 playlist.c:269: warn: Finished parsing playlists.
  2025-05-18 22:12:33 monitor_inotify.c:223: warn: WARNING: Inotify max_user_watches [8192] is low or close to the number of used watches [2] and I do not have permission to increase this limit.  Please do so manually by writing a higher value into /proc/sys/fs/inotify/max_user_watches.
root <at> komputilo ~# cat /var/log/readymedia/minidlna.log
cat /var/log/readymedia/minidlna.log
2025-05-18 22:12:33 utils.c:295: warn: make_dir: cannot create directory '/var/run/'
2025-05-18 22:12:33 minidlna.c:466: error: Unable to create pidfile directory: /var/run/minidlna/minidlna.pid
2025-05-18 22:12:33 minidlna.c:520: warn: Unset locale
2025-05-18 22:12:33 minidlna.c:1134: warn: Starting MiniDLNA version 1.3.3.
2025-05-18 22:12:33 minidlna.c:394: warn: Creating new database at /var/cache/readymedia/files.db
2025-05-18 22:12:33 minidlna.c:1182: warn: HTTP listening on port 8200
2025-05-18 22:12:33 scanner.c:731: warn: Scanning /media
2025-05-18 22:12:33 scanner.c:820: warn: Scanning /media finished (0 files)!
2025-05-18 22:12:33 playlist.c:135: warn: Parsing playlists...
2025-05-18 22:12:33 playlist.c:269: warn: Finished parsing playlists.
2025-05-18 22:12:33 monitor_inotify.c:223: warn: WARNING: Inotify max_user_watches [8192] is low or close to the number of used watches [2] and I do not have permission to increase this limit.  Please do so manually by writing a higher value into /proc/sys/fs/inotify/max_user_watches.
--8<---------------cut here---------------end--------------->8---

Thanks,
Ludo’.




Information forwarded to guix-patches <at> gnu.org:
bug#77023; Package guix-patches. (Mon, 19 May 2025 00:19:02 GMT) Full text and rfc822 format available.

Message #91 received at 77023-done <at> debbugs.gnu.org (full text, mbox):

From: Maxim Cournoyer <maxim.cournoyer <at> gmail.com>
To: Ludovic Courtès <ludo <at> gnu.org>
Cc: Tanguy Le Carrour <tanguy <at> bioneland.org>,
 Gabriel Wicki <gabriel <at> erlikon.ch>, Sughosha <sughosha <at> disroot.org>,
 Andrew Tropin <andrew <at> trop.in>, Hilton Chain <hako <at> ultrarare.space>,
 77023-done <at> debbugs.gnu.org, Janneke Nieuwenhuizen <janneke <at> gnu.org>
Subject: Re: [bug#77023] [PATCH v5] home: services: Add readymedia.
Date: Mon, 19 May 2025 09:18:27 +0900
Hi Ludovic,

Ludovic Courtès <ludo <at> gnu.org> writes:

> Hi Sughosha,
>
> Sughosha <sughosha <at> disroot.org> writes:
>
>> * gnu/home/services/upnp.scm: New file.
>> * gnu/local.mk: Register it.
>> * gnu/services/upnp.scm: Export readymedia-activation and
>> readymedia-shepherd-service.
>> (<readymedia-configuration>)[home-service?]: New field.
>> [cache-directory]: Adjust value depending on 'for-home?'.
>> [log-directory]: Ditto.
>> (readymedia-shepherd-service): Adjust 'requirement' and 'start' according to
>> 'home-service?'.
>> (readymedia-activation): Adjust creating 'media-directories' with permissions
>> according to 'home-service?'.
>> * gnu/tests/upnp.scm (%readymedia-configuration-test): Configure port with
>> %readymedia-default-port.
>> * doc/guix.texi (Miscellaneous Home Services): Document Readymedia Service.
>> (Miscellaneous Services): Add cross-reference.
>>
>> Change-Id: I5c48595d84a815d98e03c7f68a716f048903720c
>
> Finally applied, thanks!
>
> The system test passes, but it fails once every two runs or so.  Could
> you take look?
>
> However, I do not see the ‘unshare’ issue that Maxim was reporting: I
> double-checked by running the test VM manually, and here’s what I could
> see:
>
> root <at> komputilo ~# herd status readymedia
> herd status readymedia
> ● Status of readymedia:
>   It is running since 10:12:32 PM (15 seconds ago).
>   Main PID: 145
>   Command: /gnu/store/39m4bp93cc65h8i60if803hcfjw5jzyj-minidlna -f /gnu/store/x8vqpc3yqbblm7wbmg0798vvl0mj2rn6-minidlna.conf -S
>   It is enabled.
>   Provides: readymedia
>   Requires: networking user-processes
>   Will be respawned.
>   Log file: /var/log/readymedia/minidlna.log
>
> Recent messages (use '-n' to view more or less):
>   2025-05-18 22:12:33 scanner.c:731: warn: Scanning /media
>   2025-05-18 22:12:33 scanner.c:820: warn: Scanning /media finished (0 files)!
>   2025-05-18 22:12:33 playlist.c:135: warn: Parsing playlists...
>   2025-05-18 22:12:33 playlist.c:269: warn: Finished parsing playlists.
>   2025-05-18 22:12:33 monitor_inotify.c:223: warn: WARNING: Inotify max_user_watches [8192] is low or close to the number of used watches [2] and I do not have permission to increase this limit.  Please do so manually by writing a higher value into /proc/sys/fs/inotify/max_user_watches.
> root <at> komputilo ~# cat /var/log/readymedia/minidlna.log
> cat /var/log/readymedia/minidlna.log
> 2025-05-18 22:12:33 utils.c:295: warn: make_dir: cannot create directory '/var/run/'
> 2025-05-18 22:12:33 minidlna.c:466: error: Unable to create pidfile directory: /var/run/minidlna/minidlna.pid
> 2025-05-18 22:12:33 minidlna.c:520: warn: Unset locale
> 2025-05-18 22:12:33 minidlna.c:1134: warn: Starting MiniDLNA version 1.3.3.
> 2025-05-18 22:12:33 minidlna.c:394: warn: Creating new database at /var/cache/readymedia/files.db
> 2025-05-18 22:12:33 minidlna.c:1182: warn: HTTP listening on port 8200
> 2025-05-18 22:12:33 scanner.c:731: warn: Scanning /media
> 2025-05-18 22:12:33 scanner.c:820: warn: Scanning /media finished (0 files)!
> 2025-05-18 22:12:33 playlist.c:135: warn: Parsing playlists...
> 2025-05-18 22:12:33 playlist.c:269: warn: Finished parsing playlists.
> 2025-05-18 22:12:33 monitor_inotify.c:223: warn: WARNING: Inotify max_user_watches [8192] is low or close to the number of used watches [2] and I do not have permission to increase this limit.  Please do so manually by writing a higher value into /proc/sys/fs/inotify/max_user_watches.

I had applied the diff below to fix it, maybe only is the unshare error
exposed?

--8<---------------cut here---------------start------------->8---
services: Fix readymedia service.

The containerized process didn't have access to the run and db directories.

* gnu/services/upnp.scm (%readymedia-run-directory)
(%readymedia-db-directory): New variables.
(readymedia-shepherd-service) <least-authority-wrapper>: Map directories.
(readymedia-activation): Create directories in activation script.

Change-Id: I76547eb483ee65472ab0e6ec7164bf7e40fd745b

1 file changed, 15 insertions(+), 1 deletion(-)
gnu/services/upnp.scm | 16 +++++++++++++++-

modified   gnu/services/upnp.scm
@@ -122,6 +122,10 @@ (define (readymedia-configuration->config-file config)
                            (string-append key "=" value "\n")))
                         extra-config)))))
 
+(define %readymedia-run-directory "/var/run/minidlna")
+
+(define %readymedia-db-directory "/var/db/minidlna")
+
 (define (readymedia-shepherd-service config)
   "Return a least-authority ReadyMedia/MiniDLNA Shepherd service."
   (match-record config <readymedia-configuration>
@@ -149,6 +153,14 @@ (define (readymedia-shepherd-service config)
                            (file-system-mapping
                             (source minidlna-conf)
                             (target source))
+                           (file-system-mapping
+                            (source %readymedia-db-directory)
+                            (target source)
+                            (writable? #t))
+                           (file-system-mapping
+                            (source %readymedia-run-directory)
+                            (target source)
+                            (writable? #t))
                            (map (lambda (directory)
                                   (file-system-mapping
                                    (source (readymedia-media-directory-path directory))
@@ -195,7 +207,9 @@ (define (readymedia-activation config)
                         (mkdir-p/perms directory
                                        (getpw #$%readymedia-user-account)
                                        #o755)))
-                    (list #$cache-directory #$log-directory))))))
+                    (list #$cache-directory #$log-directory
+                          #$%readymedia-db-directory
+                          #$%readymedia-run-directory))))))
 
 (define readymedia-service-type
   (service-type
--8<---------------cut here---------------end--------------->8---

-- 
Thanks,
Maxim




bug archived. Request was from Debbugs Internal Request <help-debbugs <at> gnu.org> to internal_control <at> debbugs.gnu.org. (Mon, 16 Jun 2025 11:24:08 GMT) Full text and rfc822 format available.

This bug report was last modified 1 day ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.