unofficial mirror of guix-patches@gnu.org 
 help / color / mirror / code / Atom feed
From: Arun Isaac <arunisaac@systemreboot.net>
To: 72398@debbugs.gnu.org
Cc: Fabio Natali <me@fabionatali.com>
Subject: [bug#72398] [PATCH] services: Add readymedia-service-type.
Date: Tue, 13 Aug 2024 00:19:34 +0100	[thread overview]
Message-ID: <87jzglwcqh.fsf@systemreboot.net> (raw)
In-Reply-To: <4fee1c18adcfd29d40d5b557bf52db0e531c3f16.1722421592.git.me@fabionatali.com>


Hi Fabio,

Thank you for the patch. That's an excellent patch for a first Guix
service! I can only suggest a few minor improvements (mostly nitpicks
really).

Could you also suggest some quick way for me to test this service
without actually having to reconfigure my system? Can I, for example,
put it in a Guix system container or VM and test it that way?

> +(define %readymedia-cache-dir "/var/cache/readymedia")
> +(define %readymedia-log-dir "/var/log/readymedia")

Can we have these two in the <readymedia-configuration> record?

> +(define %readymedia-user-account "readymedia")
> +(define %readymedia-user-group "readymedia")

These are fine as they are.

> +  (readymedia readymedia-configuration-readymedia (default
> readymedia))

Nitpick: Just to be consistent with other services, I would indent this
(and the other fields) like so with the default on the next line:

>   (readymedia readymedia-configuration-readymedia
>               (default readymedia))

> +(define (readymedia-configuration->config-file config)
> +  "Return the ReadyMedia/MiniDLNA configuration file corresponding to CONFIG."
> +  (let ((friendly-name (readymedia-configuration-friendly-name config))
> +        (media-dirs (readymedia-configuration-media-dirs config))
> +        (port (readymedia-configuration-port config))
> +        (extra-config (readymedia-configuration-extra-config config)))
> +    (plain-file
> +     "minidlna.conf"
> +     (string-append
> +      "db_dir=" %readymedia-cache-dir "\n"
> +      "log_dir=" %readymedia-log-dir "\n"
> +      (if friendly-name (format #f "friendly_name=~a\n" friendly-name) "")
> +      (if port (format #f "port=~a\n" port) "")
> +      (string-join (map readymedia-media-dir->string media-dirs) "\n" 'suffix)
> +      (string-join extra-config "\n" 'suffix)))))

Could you use mixed-text-file here instead of plain-file? Or, you could
also try computed-file if that's more succinct.

> +(define (readymedia-shepherd-service config)
> +  "Return a least-authority ReadyMedia/MiniDLNA Shepherd service."
> +  (let* ((minidlna-conf (readymedia-configuration->config-file config))
> +         (media-dirs (readymedia-configuration-media-dirs config))
> +         (readymedia (least-authority-wrapper
> +                      (file-append
> +                       (readymedia-configuration-readymedia config)
> +                       "/sbin/minidlnad")
> +                      #:name "minidlna"
> +                      #:mappings (cons*
> +                                  (file-system-mapping
> +                                   (source %readymedia-cache-dir)
> +                                   (target source)
> +                                   (writable? #t))

Re-format by putting the first file-system-mapping on the same line as
the cons*. It's customary to format lisp function calls that way. It
makes it easier to see what the arguments are.

> +                                  (map
> +                                   (lambda (e)
> +                                     (file-system-mapping
> +                                      (source (readymedia-media-dir-path e))
> +                                      (target source)
> +                                      (writable? #f)))

Likwise with map. Put the lambda on the same line as the map.

Looking forward to a v2 patch!

Regards,
Arun




  reply	other threads:[~2024-08-12 23:21 UTC|newest]

Thread overview: 29+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-07-31 10:27 [bug#72398] [PATCH] services: Add readymedia-service-type Fabio Natali via Guix-patches via
2024-08-12 23:19 ` Arun Isaac [this message]
2024-08-19  0:27   ` Fabio Natali via Guix-patches via
2024-08-20  2:14     ` [bug#72398] [PATCH v2] " Bruno Victal
2024-08-22 10:13       ` Fabio Natali via Guix-patches via
2024-08-22 23:28         ` Arun Isaac
2024-08-23 11:04           ` [bug#72398] [PATCH v4] " Fabio Natali via Guix-patches via
2024-08-23 15:35             ` Bruno Victal
2024-08-26 10:11               ` [bug#72398] [PATCH v5] " Fabio Natali via Guix-patches via
2024-09-06 22:17                 ` Ludovic Courtès
2024-09-08 20:04                   ` [bug#72398] [PATCH v6] " Fabio Natali via Guix-patches via
2024-10-13 17:34                     ` Fabio Natali via Guix-patches via
2024-10-13 22:57                       ` Arun Isaac
2024-10-14 21:57                         ` [bug#72398] [PATCH] " Arun Isaac
2024-10-15 15:42                           ` Fabio Natali via Guix-patches via
2024-08-23 15:25           ` [bug#72398] [PATCH v2] " Bruno Victal
2024-08-28 22:51             ` Arun Isaac
2024-08-29 14:37               ` Fabio Natali via Guix-patches via
2024-08-22 23:22       ` Arun Isaac
2024-08-22 10:17 ` [bug#72398] [PATCH v3] " Fabio Natali via Guix-patches via
2024-10-15 15:31 ` [bug#72398] [PATCH v7] " Fabio Natali via Guix-patches via
2024-10-15 20:36   ` Arun Isaac
2024-10-15 20:42     ` Fabio Natali via Guix-patches via
2024-10-18  1:19       ` [bug#72398] [PATCH] " Arun Isaac
2024-10-18 17:50         ` Fabio Natali via Guix-patches via
2024-10-18 19:02           ` Fabio Natali via Guix-patches via
2024-10-18 20:04             ` Arun Isaac
2024-10-18 20:08           ` bug#72398: " Arun Isaac
2024-10-18  1:19 ` [bug#72398] [PATCH v8] " Arun Isaac

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://guix.gnu.org/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87jzglwcqh.fsf@systemreboot.net \
    --to=arunisaac@systemreboot.net \
    --cc=72398@debbugs.gnu.org \
    --cc=me@fabionatali.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/guix.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).