From: Brian Kubisiak <brian@kubisiak.com>
To: Carlo Zancanaro <carlo@zancanaro.id.au>
Cc: 74633@debbugs.gnu.org
Subject: [bug#74633] [PATCH] ui: Search channels for guix extensions
Date: Tue, 3 Dec 2024 16:59:47 -0800 [thread overview]
Message-ID: <pfuvhwyvbfi2n3higerccakdnylsv7vbadwjjnzay5sejiot3q@ki6cc4wuwcru> (raw)
In-Reply-To: <87mshdknrp.fsf@zancanaro.id.au>
Hi Carlo,
> On Sun, Dec 01 2024, Brian Kubisiak wrote:
> > diff --git a/gnu/packages.scm b/gnu/packages.scm
> > index 80c22d1d7f..05b8bf8e6d 100644
> > --- a/gnu/packages.scm
> > +++ b/gnu/packages.scm
> > @@ -147,15 +147,16 @@ (define %package-module-path
> > (let* ((not-colon (char-set-complement (char-set #\:)))
> > (environment (string-tokenize (or (getenv "GUIX_PACKAGE_PATH") "")
> > not-colon))
> > - (channels-scm channels-go (package-path-entries)))
> > + (channels-scm (package-path-entries)))
> > ;; Automatically add channels and items from $GUIX_PACKAGE_PATH to Guile's
> > ;; search path. For historical reasons, $GUIX_PACKAGE_PATH goes to the
> > ;; front; channels go to the back so that they don't override Guix' own
> > ;; modules.
>
> This comment should be moved onto add-channels-to-load-path!. Possibly
> even as a docstring.
Will do.
> > diff --git a/guix/self.scm b/guix/self.scm
> > index 2652688c71..28239d53f5 100644
> > --- a/guix/self.scm
> > +++ b/guix/self.scm
> > @@ -882,6 +882,7 @@ (define* (compiled-guix source #:key
> > ,(local-file "../guix/store/schema.sql")))
> >
> > #:extensions (list guile-gcrypt
> > + guile-git ;for (guix git)
>
> I don't know enough to know if this is a problem, but it's a shame to
> have to add this, given I don't think this change actually ends up using
> any git functionality.
Honestly I'm not sure what the are the downsides of this, since I
don't see how *core-module* would get used without *extra-modules* or
why *core-modules* doesn't include all the dependencies. Maybe Ludo
knows more?
> > diff --git a/guix/ui.scm b/guix/ui.scm
> > index eba12c8616..28690b22bc 100644
> > --- a/guix/ui.scm
> > +++ b/guix/ui.scm
> > @@ -2192,9 +2193,15 @@ (define* (command-files #:optional directory)
> >
> > (define (extension-directories)
> > "Return the list of directories containing Guix extensions."
> > - (filter file-exists?
> > - (parse-path
> > - (getenv "GUIX_EXTENSIONS_PATH"))))
> > + (add-channels-to-load-path!)
> > + (let ((channels (package-path-entries)))
> > + (filter file-exists?
> > + (append
> > + (parse-path
> > + (getenv "GUIX_EXTENSIONS_PATH"))
> > + (map
> > + (cut string-append <> "/guix/extensions")
> > + channels)))))
>
> I don't think you need the (append ...). According to the manual,
> parse-path takes another argument as a "tail" for the resulting list, so
> (parse-path (getenv "GUIX_EXTENSIONS_PATH") (map ... channels)) should
> be enough here.
I saw that on your patch, good to know!
> Am I right in thinking that this will look inside the channels at
> /guix/extensions to try to find things?
Correct. I chose this to match existing behavior, since
$GUIX_EXTENSIONS_PATH points at this directory for an extension
installed as a package. (I was able to tkae an existing extension and
pull it in as a channel and everything "just worked" without changing
any code or directory structure in the extension)
> 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).
Thanks for the feedback,
Brian
next prev parent reply other threads:[~2024-12-04 1:01 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-12-01 14:53 [bug#74633] [PATCH] ui: Search channels for guix extensions Brian Kubisiak
2024-12-02 17:25 ` Ludovic Courtès
2024-12-03 11:29 ` Carlo Zancanaro
2024-12-04 0:59 ` Brian Kubisiak [this message]
2024-12-05 0:27 ` Carlo Zancanaro via Guix-patches via
2024-12-08 22:03 ` [bug#74633] [PATCH v2] " Brian Kubisiak
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=pfuvhwyvbfi2n3higerccakdnylsv7vbadwjjnzay5sejiot3q@ki6cc4wuwcru \
--to=brian@kubisiak.com \
--cc=74633@debbugs.gnu.org \
--cc=carlo@zancanaro.id.au \
/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).