home: services: Add readymedia.

* 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
Signed-off-by: Ludovic Courtès <ludo@gnu.org>
This commit is contained in:
Sughosha 2025-05-10 20:04:58 +05:30 committed by Ludovic Courtès
parent 1220d1a84e
commit b1d2483ebe
No known key found for this signature in database
GPG key ID: 090B11993D9AEBB5
5 changed files with 138 additions and 14 deletions

View file

@ -0,0 +1,55 @@
;;; GNU Guix --- Functional package management for GNU
;;; Copyright © 2025 Sughosha <sughosha@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 '()))))))