unofficial mirror of help-guix@gnu.org 
 help / color / mirror / Atom feed
* Emacs use-package: Guix backend?
@ 2020-12-19  9:42 Ricardo Wurmus
  2020-12-20  0:10 ` Fredrik Salomonsson
  2020-12-20  7:24 ` zimoun
  0 siblings, 2 replies; 4+ messages in thread
From: Ricardo Wurmus @ 2020-12-19  9:42 UTC (permalink / raw)
  To: help-guix

Hi Guix,

I recently moved all my Emacs packages to a separate profile, which is
controlled by a manifest that’s generated from my init.org configuration
file.  I like this, because I can separately upgrade packages from my
main profile and keep my Emacs configuration self-contained.

What still annoys me, though, is that package installation is separate
from configuration.  I don’t really want to be forced to update the
manifest at the top of my init.org before I can configure the package
somewhere at the bottom of the init.org.

The “use-package” macro was designed to allow for both installation and
configuration in the same place.  By default it uses package.el to
install packages when they aren’t available yet.  I’d like to use
“use-package”, but I’d like it to install packages with Guix and also
install to a separate Guix profile, preferably via a manifest.

Package managers are supposed to override “use-package-ensure-function”
and/or “use-package-pre-ensure-function” to use something other than
package.el.

Before I embark on this journey, do any of you have travel reports to
share?  Do you think this is worth doing?  If so, where could we add
this feature so that all Guix users benefit from it?  Emacs-Guix?

-- 
Ricardo


^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: Emacs use-package: Guix backend?
  2020-12-19  9:42 Ricardo Wurmus
@ 2020-12-20  0:10 ` Fredrik Salomonsson
  2020-12-20  7:24 ` zimoun
  1 sibling, 0 replies; 4+ messages in thread
From: Fredrik Salomonsson @ 2020-12-20  0:10 UTC (permalink / raw)
  To: Ricardo Wurmus, help-guix


Hi Ricardo,

Ricardo Wurmus <rekado@elephly.net> writes:

> I recently moved all my Emacs packages to a separate profile, which is
> controlled by a manifest that’s generated from my init.org configuration
> file.  I like this, because I can separately upgrade packages from my
> main profile and keep my Emacs configuration self-contained.
>
> What still annoys me, though, is that package installation is separate
> from configuration.  I don’t really want to be forced to update the
> manifest at the top of my init.org before I can configure the package
> somewhere at the bottom of the init.org.
>
> The “use-package” macro was designed to allow for both installation and
> configuration in the same place.  By default it uses package.el to
> install packages when they aren’t available yet.  I’d like to use
> “use-package”, but I’d like it to install packages with Guix and also
> install to a separate Guix profile, preferably via a manifest.
>
> Package managers are supposed to override “use-package-ensure-function”
> and/or “use-package-pre-ensure-function” to use something other than
> package.el.
>
> Before I embark on this journey, do any of you have travel reports to
> share?

My 2 cents.

I got multiple profiles; one for emacs, nyxt, git and guile for example.
I wrote a small bash script to make it easy for me to upgrade all of
them or just a subset. What I like about this is that upgrading emacs
and all of its packages are the same as upgrading any of the other
profiles. I.e. I don't have to remember to run
`list-packages` -> `U` -> `x` to update my emacs packages anymore. Plus
I get the bonus of anything goes wrong I can just rollback the emacs
profile.

My emacs manifest is completely decoupled from my configuration. There
are potential of them becoming out of sync. But in practice I haven't
notice anything of that. I haven't found it annoying (yet) to update my
emacs manifest before adding the configuration. Mostly because my
package configuration has been quite stable. It's just recently I've
been starting testing some new packages (after seeing all the cool stuff
from the emacsconf).

> Do you think this is worth doing?

Yes, would be great to have use-package directly feed the manifest and
have some tighter coupling between the configuration and guix.

There are some speed bumps that I can see, one being for example
emacs-flymake-shellcheck does not give you shellcheck so in my manifest
I list both emacs-flymake-shellcheck and shellcheck for that to work.
Maybe keyword-extension[0] can handle cases like these? I.e. you have a
keyword where you can specify external dependencies. Something like:

(use-package flymake-shellcheck
  :guix-install '("shellcheck"))

[0] https://github.com/jwiegley/use-package/tree/master#keyword-extensions

Also, at least for me, I would still like to be able to upgrade/rollback
the emacs profile together with the rest of guix. Instead of that being
yet another step to update your whole system.

> If so, where could we add this feature so that all Guix users benefit
> from it? Emacs-Guix?

That is a good question :). Emacs-Guix seems like a good fit to me as it
already has the logic to talk to guix from emacs.

-- 
s/Fred[re]+i[ck]+/Fredrik/g


^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: Emacs use-package: Guix backend?
  2020-12-19  9:42 Ricardo Wurmus
  2020-12-20  0:10 ` Fredrik Salomonsson
@ 2020-12-20  7:24 ` zimoun
  1 sibling, 0 replies; 4+ messages in thread
From: zimoun @ 2020-12-20  7:24 UTC (permalink / raw)
  To: Ricardo Wurmus, help-guix

Hi Ricardo,

I have similar workflow as Fredrik.  Tiny more complement.

On Sat, 19 Dec 2020 at 10:42, Ricardo Wurmus <rekado@elephly.net> wrote:

> I recently moved all my Emacs packages to a separate profile, which is
> controlled by a manifest that’s generated from my init.org configuration
> file.  I like this, because I can separately upgrade packages from my
> main profile and keep my Emacs configuration self-contained.

I have a manifest file containing the Emacs packages and related ones
(notmuch, aspell, aspell-dict-, etc.) and a tiny/dumb Bash script to
install/upgrade from this manifest.  One key point is to also track the
channels.scm (guix describe -f channels) to be able to reproduce
elsewhere easily.

(I would like to replace this Bash helper by “guix repl -- script.scm”
but have not find the time to implement it.  Even, I am still annoying
by “guix repl -- ~/.config/guix/scripts/foo.scm” instead of “guix foo”;
see <https://yhetil.org/guix/86d00evkmr.fsf@gmail.com>.)

The manifest file is usable with all the Guix commands–guix weather,
build, pack to name the ones I use the most with my Emacs packages.
This appears to me a big advantage.

> What still annoys me, though, is that package installation is separate
> from configuration.  I don’t really want to be forced to update the
> manifest at the top of my init.org before I can configure the package
> somewhere at the bottom of the init.org.

Before, I used ’use-package’ but then switched to
’with-eval-after-load’.  My main use of ’use-package’ was because of
:ensure which was not relevant.

Since it is more important for me to check the availability or build or
pack my Emacs profile than lost the sync between install and
configuration, I am fine with this separation.

What still annoys me, though, is the usual Guix UI which is not handy,
for instance, I use this:

  guix time-machine -C ~/.config/guix/channels-emacs.scm \
       -- install \
          -m ~/.config/guix/manifests/emacs.scm \
          -p ~/.cache/guix/profiles/emacs/emacs
       
and it would be easier to deal with multiple profile if default
locations for manifest files and profile symlink (and channel file)
would be known by Guix.

On the other hand, I also have manifest+channels files and profile
inside all the folders about my projects.  It has already been discussed
some time ago; something about UI is missing to deal with multiple
profiles, IMHO.  Maybe your proposal about Emacs could also lead to
discussions on how to add this missing part: I do now remember if we
have not reached a consensus or if we did but no one then implemented
it.

> The “use-package” macro was designed to allow for both installation and
> configuration in the same place.  By default it uses package.el to
> install packages when they aren’t available yet.  I’d like to use
> “use-package”, but I’d like it to install packages with Guix and also
> install to a separate Guix profile, preferably via a manifest.
>
> Package managers are supposed to override “use-package-ensure-function”
> and/or “use-package-pre-ensure-function” to use something other than
> package.el.

Yeah a story similar to straight.el could be nice. :-)


> Before I embark on this journey, do any of you have travel reports to
> share?  Do you think this is worth doing?  If so, where could we add
> this feature so that all Guix users benefit from it?  Emacs-Guix?

I switched from ’use-package’ to ’with-eval-after-load’ at the previous
French lockdown and nothing is missing me.  Even if :ensure would be
provided by Guix, I do not think I would switch back.  That’s my travel
report. :-)

Cheers,
simon


^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: Emacs use-package: Guix backend?
@ 2021-01-01  4:03 John Soo
  0 siblings, 0 replies; 4+ messages in thread
From: John Soo @ 2021-01-01  4:03 UTC (permalink / raw)
  To: zimoun; +Cc: Help-Guix

     Hey guix,  

  
I was perusing the use-package docs and it seems guix is already somewhat supported. Have you seen :ensure-system-package?   https://github.com/jwiegley/use-package#use-package-ensure-system-package    The system-package dependency lists guix as supported. I suppose one difficulty is that it doesn’t really cover emacs packages.    However the ensure functionality is configurable with use-package-ensure-function and use-package-pre-ensure-function. That is mentioned in the docs also:   https://github.com/jwiegley/use-package#usage-with-other-package-managers. I would like to see that in emacs-guix. On that note, I have some news and work to do on that front...
  

  
What do you think?
  

  
- John


^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2021-01-01  4:04 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-01-01  4:03 Emacs use-package: Guix backend? John Soo
  -- strict thread matches above, loose matches on Subject: below --
2020-12-19  9:42 Ricardo Wurmus
2020-12-20  0:10 ` Fredrik Salomonsson
2020-12-20  7:24 ` zimoun

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).