GNU bug report logs - #66376
[PATCH] fix: correct emacs-guix not finding packages from user channels

Previous Next

Package: guix-patches;

Reported by: Sergio Pastor Pérez <sergio.pastorperez <at> outlook.es>

Date: Fri, 6 Oct 2023 17:23:01 UTC

Severity: normal

Tags: patch

Full log


View this message in rfc822 format

From: Sergey Trofimov <sarg <at> sarg.org.ru>
To: Sergio Pastor Pérez <sergio.pastorperez <at> outlook.es>
Cc: 66376 <at> debbugs.gnu.org
Subject: [bug#66376] [PATCH] fix: correct emacs-guix not finding packages from user channels
Date: Tue, 06 May 2025 10:55:35 +0200
Hi Sergio,

Sergio Pastor Pérez <sergio.pastorperez <at> outlook.es> writes:

> ---
> Hi.
>
> I've noticed that `emacs-guix' is not able to fetch packages from user
> channels. This is a quick fix that could be implemented much easier with some
> help.
>
> As you can see, there is lots of redundant code from modules of the guix core,
> such as: 'gnu/packages.scm' as well as 'guix/describe.scm'.
>
> The issue is that neither of the functions exposed, which are used on the call
> hierarchy, accept a parameter for targeting a profile so all this functions need
> to be reimplemented to change the lowest function on the call hierarchy.
>
> I thought of using:
>
> (module-define! (resolve-module '(guix describe)) 'current-profile
>   (lambda ()
>       "Return the profile (created by 'guix pull') the calling process lives in,
>   or #f if this is not applicable."
>       (find (lambda (str)
>               (string-contains str "current-guix"))
>             (user-profiles))))
>
>
> But this is not possible since most of the functions up in the call hierarchy
> are memoized with `mlambda'.
>
> For now this is what I'm using for myself. I submit this patch hopping that someone will have a more elegant solution.
>
> Will it be okay to redefine the functions from the guix core into generic ones
> that accept a profile as a parameter?
>
> The ones we have could just call the more generic one with a specific parameter
> so they will be the 'curried' versions.
>
> What do you think? Any ideas?
>

%package-module-path is a parameter, which could be set when
 initializing the REPL. It would make `fold-packages` use the right list
 of modules.

So try running this just after `M-x guix-switch-to-repl`. Then `M-x
guix-package-locations` should show the locations from your channels.

--8<---------------cut here---------------start------------->8---
(guix-eval-in-repl 
 (format "((@ (gnu packages) %%package-module-path) '%S)"
         (append (guix-list-maybe guix-load-path)
                 (guix-list-maybe
                  (when guix-repl-use-latest
                      (guix-guile-site-directory guix-pulled-profile))))))
--8<---------------cut here---------------end--------------->8---




This bug report was last modified 45 days ago.

Previous Next


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