Subject: [bug#74633] [PATCH] ui: Search channels for guix extensions

From: Carlo Zancanaro <[email-masked]>
Date: Thu, 05 Dec 2024 11:27:05 +1100

On Tue, Dec 03 2024, Brian Kubisiak wrote:
>> That is, if I wanted to add a command "guix foo" I would need to
>> define a module in $channel_dir/guix/extensions/guix/scripts/foo.scm?
>
> This is not required, the command "guix foo" could be defined in
> $channel_dir/guix/extensions/foo.scm. The command-files function
> doesn't add /guix/scripts if a directory is passed as an argument and
>  the run-guix-command function will resolve '(guix extensions foo)
> if foo.scm exists in an extension directory
> (i.e. $channel_dir/guix/extensions/foo.scm exists).

Ah, I see. That sounds good to me.

Given the channel is also being added to %load-path, I expect you can
add a command by defining (guix scripts foo) or (guix extensions foo)
and it will work either way (finding the former first).

We should document this method of extension in the manual. I think a new
section in the "(guix) Channels" chapter for "Declaring Custom Commands"
would be helpful. I might have some time to write something in the next
few days, but if you get a chance before then go ahead.

Thanks for your work on this,

Carlo