Subject: bug#48331: Emacs' describe-package doesn't work for packages managed by guix

From: Leo Prikler <[email-masked]>
Date: Tue, 11 May 2021 12:05:31 +0200

Am Montag, den 10.05.2021, 10:51 +0300 schrieb Andrew Tropin:
> describe-package and list-packages do not show emacs packages,
> installed
> with guix. Packages themselves work perfectly fine, but not listed in
> list-packages and can't be accessed with describe-package.
> 
> Way to reproduce:
> 
> guix environment --pure --ad-hoc emacs emacs-treemacs
> 
> emacs -q
> 
> M-x treemacs ;; Works fine
> C-h P treemacs ;; Doesn't work
> M-x list-packages ;; Doesn't list treemacs
> 
> Played around with it a little bit, still not sure how to solve.
This mail brought me back to the good old days of 2018, when I was
still using Gentoo and had to solve a similar issue.

The problem here is, that Guix does not include the <package>-pkg.el
file, that would typically be generated by package.el.  To deal with
this, you have to provide package specs on your own.  There already
exists a utility to locate libraries in a package manager agnostic
fashion [1], all you need to do is to feed back that information to
package.el.

I have now published emacs-dpd [2], which does exactly that.  To use it
for your Guix Emacs packages, execute 
  (dpd (list "$GUIX_PROFILE/share/emacs/site-lisp" ...))
replacing "$GUIX_PROFILE" with the actual profile, after `package-
initialize' has run with `dpd-fuzzy-recognize' in `dpd-recognize-hook'. 
I might write a more detailed README later.

Neither packed nor dpd are currently packaged in Guix.  packed can
easily be imported from melpa-stable, but for dpd you'd have to write
your own guix.scm.  I might do that at some point as well.

We already had modifications in emacs-build-system recently, so if you
want to argue, that all Emacs packages should have that <package>-
pkg.el to work with package.el out of the box, I would ask you to wait,
so as to not cause an "Emacs world" rebuild again after only ten days. 
I also don't know whether Guix has the same information as package.el
at build time, but that might change with time as well.  Particularly,
there will hopefully be a move towards supplying name and version at
build, which would give us the most important information.

Regards,
Leo

[1] https://github.com/emacscollective/packed
[2] https://gitlab.com/leoprikler/emacs-dpd