GNU bug report logs - #74425
[PATCH] ui: Include channels in load path before searching for commands.

Previous Next

Package: guix-patches;

Reported by: Carlo Zancanaro <carlo <at> zancanaro.id.au>

Date: Mon, 18 Nov 2024 22:32:02 UTC

Severity: normal

Tags: patch

Merged with 74633

Done: Ludovic Courtès <ludo <at> gnu.org>

Bug is archived. No further changes may be made.

Full log


View this message in rfc822 format

From: Ludovic Courtès <ludo <at> gnu.org>
To: Carlo Zancanaro <carlo <at> zancanaro.id.au>
Cc: Josselin Poiret <dev <at> jpoiret.xyz>, Simon Tournier <zimon.toutoune <at> gmail.com>, Mathieu Othacehe <othacehe <at> gnu.org>, Tobias Geerinckx-Rice <me <at> tobias.gr>, 74425 <at> debbugs.gnu.org, Christopher Baines <guix <at> cbaines.net>
Subject: [bug#74425] [PATCH] ui: Include channels in load path before searching for commands.
Date: Thu, 21 Nov 2024 13:14:00 +0100
Hello,

Carlo Zancanaro <carlo <at> zancanaro.id.au> skribis:

> * guix/ui.scm (extension-directories): Add channel directories to load path,
> compiled load path, and returned list of directories.
>
> Co-authored-by: Ludovic Courtès <ludo <at> gnu.org>
> Change-Id: I3063cbf7164a065b2c6c2a5c6473df79ce8cbe9b

Nice, thanks for looking into it!

>  (define (extension-directories)
>    "Return the list of directories containing Guix extensions."
> -  (filter file-exists?
> -          (parse-path
> -           (getenv "GUIX_EXTENSIONS_PATH"))))
> +  (define package-path-entries
> +    ;; We need to resolve this lazily, because even using an #:autoload is too
> +    ;; much and breaks compilation during "guix pull".
> +    (module-ref (resolve-module `(guix describe))
> +                (symbol-append 'package-path-entries)))
> +  (let ((scm-path go-path (package-path-entries)))
> +    (set! %load-path (append %load-path scm-path))
> +    (set! %load-compiled-path (append %load-compiled-path go-path))
> +    (filter file-exists?
> +            (parse-path (getenv "GUIX_EXTENSIONS_PATH") scm-path))))

I think you could do:

  #:autoload (guix describe) (package-path-entries)

instead of doing the trick above.

Two things:

  1. The ‘%load-path’ and ‘%load-compiled-path’ modifications can now be
     removed from (gnu packages), after checking that GUIX_PACKAGE_PATH
     still takes precedence.

  2. The performance impact of this change must be tested, in particular
     the startup time of ‘guix’ commands since they’ll now be loading
     (guix channels) & co. unconditionally.

     One way to do that might be:

       PROFILE=$(guix time-machine -q --url=/path/to/checkout)
       guix shell time -- time $PROFILE/bin/guix build --help
       strace -c $PROFILE/bin/guix build --help
     
Could you give it a try?

Ludo’.




This bug report was last modified 126 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.