Subject: Re: [bug#36563] [PATCH] guix: Add directory to channel.

From: Ludovic Courtès <[email-masked]>
Date: Sat, 13 Jul 2019 22:49:36 +0200

Jan Nieuwenhuizen <[email-masked]> skribis:

> Yes, I agree that this should be the first option to support.  Attached
> is a second attempt: I removed the FIXME and moved `directory' to
> channel-metadata.

That was fast!

> A downside could be that this could make a channel user dependent on
> upstream to provide this `.guix-channel' file; probably best to worry
> about that when the need arises :)

If upstream doesn’t provide this file, then the channel is effectively
unusable because of a file name/module name mismatch, no?

> From 5d78a7eab391ea93c044d85736706b333c2dfee8 Mon Sep 17 00:00:00 2001
> From: Jan Nieuwenhuizen <[email-masked]>
> Date: Sat, 13 Jul 2019 16:31:50 +0200
> Subject: [PATCH] channels: Add optional directory to channel metadata.
>
> * guix/channels.scm (<channel-metadata>): Add directory slot.  Update users.
> (read-channel-metadata-from-source): New function.
> (standard-module-derivation): Use it.
> * doc/guix.texi (Package Modules in a Subdirectory): New subsection.

[...]

> +@cindex subdirectory, channels
> +@subsection Package Modules in a Subdirectory
> +
> +A developer may include a @file{guix} subdirectory in their upstream source
> +that contains additional or modified Guix package descriptions.  Typically,
> +their toplevel @file{guix.scm} then uses those package definitions:

What about framing it along these lines:

  As a channel author, you may want to keep your channel modules in a
  sub-directory.  In that case, blah…

?

> +By adding a meta-data file @file{.guix-channel} that specifies the
> +subdirectory that contains the Guix package descriptions it can be used
> +directly as a channel:
> +
> +@lisp
> +(channel
> + (directory "guix"))

It should be:

  (channel
    (version 0)
    (directory "something"))

(‘read-channel-metadata’ currently ignores ‘version’, but that’s a bug
that we should fix afterwards, IMO.)

> +            (let* ((subdir (if #$directory
> +                               (string-append "/" #$directory)
> +                               ""))
> +                   (dir (string-append #$source subdir)))

Maybe s/dir/source/?

Otherwise LGTM!

Thanks,
Ludo’.