unofficial mirror of help-guix@gnu.org 
 help / color / mirror / Atom feed
* Guix as a package manager for Emacs
@ 2020-01-22  4:09 EuAndreh via
  2020-01-22  9:43 ` Pierre Neidhardt
                   ` (2 more replies)
  0 siblings, 3 replies; 11+ messages in thread
From: EuAndreh via @ 2020-01-22  4:09 UTC (permalink / raw)
  To: help-guix

Hi Guix!

How can I get in Guix something similar to Nix's emacsWithPackages:
https://nixos.org/nixpkgs/manual/#sec-emacs-config

It shows how to use Nix's packaging capabilities to setup and configure
Emacs, instead of having "use-package" (or similar tools) downloading
and installing packages.

I found some previous messages and discussions in the lists archives,
but couldn't find guidance on how to proceed.

How can I accomplish it with Guix?

Thanks :)

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

* Re: Guix as a package manager for Emacs
  2020-01-22  4:09 Guix as a package manager for Emacs EuAndreh via
@ 2020-01-22  9:43 ` Pierre Neidhardt
  2020-01-22 11:47   ` EuAndreh via
  2020-01-22 14:14 ` zimoun
  2020-01-23 15:23 ` zimoun
  2 siblings, 1 reply; 11+ messages in thread
From: Pierre Neidhardt @ 2020-01-22  9:43 UTC (permalink / raw)
  To: EuAndreh, help-guix

[-- Attachment #1: Type: text/plain, Size: 550 bytes --]

Hi!

I'm not sure this is the answer you are looking for, but with Guix you
can simply install the desired "emacs-*" packages.

Should you install them to a non default profile, make sure you source
the relevant etc/profile or export EMACSLOADPATH to

$GUIX_PROFILE/share/emacs/26.3/lisp

(Replace 26.3 with your Emacs version.)

Once this is done, you should be able to call

  (require ...)

from your Emacs initialization file, or

  M-x load-library

interactively.

Cheers!

-- 
Pierre Neidhardt
https://ambrevar.xyz/

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 487 bytes --]

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

* Re: Guix as a package manager for Emacs
  2020-01-22  9:43 ` Pierre Neidhardt
@ 2020-01-22 11:47   ` EuAndreh via
  0 siblings, 0 replies; 11+ messages in thread
From: EuAndreh via @ 2020-01-22 11:47 UTC (permalink / raw)
  To: Pierre Neidhardt, help-guix

Pierre Neidhardt <mail@ambrevar.xyz> writes:

> Hi!

Hello :)

> I'm not sure this is the answer you are looking for, but with Guix you
> can simply install the desired "emacs-*" packages.

So if I were to add the 'emacs' and 'emacs-evil-collection' packages, I
could just require the packages? I'll try this next and report back if I
encounter any problem.

I actually considered this possibility, but ruled this out because it
sounded too simple xD.

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

* Re: Guix as a package manager for Emacs
  2020-01-22  4:09 Guix as a package manager for Emacs EuAndreh via
  2020-01-22  9:43 ` Pierre Neidhardt
@ 2020-01-22 14:14 ` zimoun
  2020-01-22 14:17   ` zimoun
  2020-01-28 15:34   ` EuAndreh via
  2020-01-23 15:23 ` zimoun
  2 siblings, 2 replies; 11+ messages in thread
From: zimoun @ 2020-01-22 14:14 UTC (permalink / raw)
  To: EuAndreh; +Cc: help-guix

Hi,

On Wed, 22 Jan 2020 at 05:10, EuAndreh via <help-guix@gnu.org> wrote:

> How can I get in Guix something similar to Nix's emacsWithPackages:
> https://nixos.org/nixpkgs/manual/#sec-emacs-config

I do not understand what Nix does. Namely, from where do the packages
come from? Nix or ELPA?


> It shows how to use Nix's packaging capabilities to setup and configure
> Emacs, instead of having "use-package" (or similar tools) downloading
> and installing packages.

The easiest way to achieve similar is to use a manifest file, IMHO.

Let consider the file below named '/tmp/my-emacs-config.scm', then it
is easy to create a profile (or environment):

   guix package -m /tmp/my-emacs-config.scm -p /tmp/my-profile

and the Emacs living in this very profile should be correctly setup-ed
for your needs. Therefore let source the profile or whatever and done.
:-)


Be careful, a manifest file must return a manifest, so the order matters.

However, the file '~/.emacs' is not "protected" and you can add some
Scheme code to change it as read-only.


Another less straightfoward path is to write our own package
definition. But with the current situation -- about partially
rewriting on-the-fly the 'arguments' field -- it will be a bit harder.


Hope that helps.
simon



--8<---------------cut here---------------start------------->8---
(use-package-modules emacs emacs-xyz)

(with-output-to-file (string-append (getenv "HOME") "/.emacs")
  (lambda ()
    (display
     (string-append ";; initialize package
            \n"
                    "
            \n"
                    "(require 'package)
            \n"
                    "(package-initialize 'noactivate)
            \n"
                    "(eval-when-compile
            \n"
                    "  (require 'use-package))
            \n"
                    "
            \n"
                    ";; load some packages
            \n"
                    "
            \n"
                    "(use-package company
            \n"
                    "  :bind (\"<C-tab>\" . company-complete)
            \n"
                    "  :diminish company-mode
            \n"
                    "  :commands (company-mode global-company-mode)
            \n"
                    "  :defer 1
            \n"
                    "  :config
            \n"
                    "  (global-company-mode))
            \n"
                    "
            \n"
                    "(use-package counsel
            \n"
                    "  :commands (counsel-descbinds)
            \n"
                    "  :bind (([remap execute-extended-command] .
counsel-M-x)     \n"
                    "         (\"C-x C-f\" . counsel-find-file)
            \n"
                    "         (\"C-c g\" . counsel-git)
            \n"
                    "         (\"C-c j\" . counsel-git-grep)
            \n"
                    "         (\"C-c k\" . counsel-ag)
            \n"
                    "         (\"C-x l\" . counsel-locate)
            \n"
                    "         (\"M-y\" . counsel-yank-pop)))
            \n"
                    "
            \n"
                    "(use-package flycheck
            \n"
                    "  :defer 2
            \n"
                    "  :config (global-flycheck-mode))
            \n"
                    "
            \n"
                    "(use-package ivy
            \n"
                    "  :defer 1
            \n"
                    "  :bind ((\"C-c C-r\" . ivy-resume)
            \n"
                    "         (\"C-x C-b\" . ivy-switch-buffer)
            \n"
                    "         :map ivy-minibuffer-map
            \n"
                    "         (\"C-j\" . ivy-call))
            \n"
                    "  :diminish ivy-mode
            \n"
                    "  :commands ivy-mode
            \n"
                    "  :config
            \n"
                    "  (ivy-mode 1))
            \n"
                    "
            \n"
                    "(use-package magit
            \n"
                    "  :defer
            \n"
                    "  :if (executable-find \"git\")
            \n"
                    "  :bind ((\"C-x g\" . magit-status)
            \n"
                    "         (\"C-x G\" . magit-dispatch-popup))
            \n"
                    "  :init
            \n"
                    "  (setq magit-completing-read-function
'ivy-completing-read)) \n"
                    "
            \n"
                    "(use-package projectile
            \n"
                    "  :commands projectile-mode
            \n"
                    "  :bind-keymap (\"C-c p\" .
projectile-command-map)           \n"
                    "  :defer 5
            \n"
                    "  :config
            \n"
                    "  (projectile-global-mode))
            \n"))))

(packages->manifest
 (list emacs
       emacs-company
       emacs-ivy
       emacs-flycheck
       emacs-ivy
       emacs-magit
       emacs-projectile
       emacs-use-package))
--8<---------------cut here---------------end--------------->8---

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

* Re: Guix as a package manager for Emacs
  2020-01-22 14:14 ` zimoun
@ 2020-01-22 14:17   ` zimoun
  2020-01-22 15:11     ` John Soo
  2020-01-28 15:32     ` EuAndreh via
  2020-01-28 15:34   ` EuAndreh via
  1 sibling, 2 replies; 11+ messages in thread
From: zimoun @ 2020-01-22 14:17 UTC (permalink / raw)
  To: EuAndreh; +Cc: help-guix

Ah crap!

On Wed, 22 Jan 2020 at 15:14, zimoun <zimon.toutoune@gmail.com> wrote:

> --8<---------------cut here---------------start------------->8---
> (use-package-modules emacs emacs-xyz)
>
> (with-output-to-file (string-append (getenv "HOME") "/.emacs")
>   (lambda ()
>     (display
>      (string-append ";; initialize package
>             \n"
>                     "
>             \n"

The formatting failed! :-(

I let you use Emacs to reformat correctly. :-)

> ))))

[...]
> --8<---------------cut here---------------end--------------->8---

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

* Re: Guix as a package manager for Emacs
  2020-01-22 14:17   ` zimoun
@ 2020-01-22 15:11     ` John Soo
  2020-01-23 15:26       ` zimoun
  2020-01-28 15:32     ` EuAndreh via
  1 sibling, 1 reply; 11+ messages in thread
From: John Soo @ 2020-01-22 15:11 UTC (permalink / raw)
  To: zimoun; +Cc: EuAndreh, help-guix

Hi everyone,

Has anyone used the portable dumper yet? Could it be used to make a custom emacs package with the specified emacs packages dumped to a separate dump file?

Just some thoughts I’ve had and tried recently but I don’t really know where the dumper is at these days.

John

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

* Re: Guix as a package manager for Emacs
  2020-01-22  4:09 Guix as a package manager for Emacs EuAndreh via
  2020-01-22  9:43 ` Pierre Neidhardt
  2020-01-22 14:14 ` zimoun
@ 2020-01-23 15:23 ` zimoun
  2020-01-28 15:22   ` EuAndreh via
  2 siblings, 1 reply; 11+ messages in thread
From: zimoun @ 2020-01-23 15:23 UTC (permalink / raw)
  To: EuAndreh; +Cc: help-guix

Hi,

On Wed, 22 Jan 2020 at 05:10, EuAndreh via <help-guix@gnu.org> wrote:

> It shows how to use Nix's packaging capabilities to setup and configure
> Emacs, instead of having "use-package" (or similar tools) downloading
> and installing packages.

[...]

> How can I accomplish it with Guix?

Maybe you can give a try to Guix Home Manager. :-)

https://framagit.org/tyreunom/guix-home-manager


All the best,
simon

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

* Re: Guix as a package manager for Emacs
  2020-01-22 15:11     ` John Soo
@ 2020-01-23 15:26       ` zimoun
  0 siblings, 0 replies; 11+ messages in thread
From: zimoun @ 2020-01-23 15:26 UTC (permalink / raw)
  To: John Soo; +Cc: EuAndreh, help-guix

On Wed, 22 Jan 2020 at 16:11, John Soo <jsoo1@asu.edu> wrote:

> Has anyone used the portable dumper yet? Could it be used to make a custom emacs package with the specified emacs packages dumped to a separate dump file?

Interesting idea. :-)


> Just some thoughts I’ve had and tried recently but I don’t really know where the dumper is at these days.

Do not know neither. I have understood reading emacs-devel that the
plan was to release it with 27. Who knows... ;-)


All the best,
simon

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

* Re: Guix as a package manager for Emacs
  2020-01-23 15:23 ` zimoun
@ 2020-01-28 15:22   ` EuAndreh via
  0 siblings, 0 replies; 11+ messages in thread
From: EuAndreh via @ 2020-01-28 15:22 UTC (permalink / raw)
  To: zimoun; +Cc: help-guix

[-- Attachment #1: Type: text/plain, Size: 228 bytes --]

zimoun <zimon.toutoune@gmail.com> writes:

> Maybe you can give a try to Guix Home Manager. :-)
>
> https://framagit.org/tyreunom/guix-home-manager

Hmmmm, that looks interesting!

I'll take a look at it, thanks for the link :)

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 832 bytes --]

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

* Re: Guix as a package manager for Emacs
  2020-01-22 14:17   ` zimoun
  2020-01-22 15:11     ` John Soo
@ 2020-01-28 15:32     ` EuAndreh via
  1 sibling, 0 replies; 11+ messages in thread
From: EuAndreh via @ 2020-01-28 15:32 UTC (permalink / raw)
  To: zimoun; +Cc: help-guix, Pierre Neidhardt

[-- Attachment #1: Type: text/plain, Size: 144 bytes --]

zimoun <zimon.toutoune@gmail.com> writes:

> The formatting failed! :-(
>
> I let you use Emacs to reformat correctly. :-)

Challenge accepted!

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 832 bytes --]

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

* Re: Guix as a package manager for Emacs
  2020-01-22 14:14 ` zimoun
  2020-01-22 14:17   ` zimoun
@ 2020-01-28 15:34   ` EuAndreh via
  1 sibling, 0 replies; 11+ messages in thread
From: EuAndreh via @ 2020-01-28 15:34 UTC (permalink / raw)
  To: zimoun; +Cc: help-guix, Pierre Neidhardt

[-- Attachment #1: Type: text/plain, Size: 907 bytes --]

zimoun <zimon.toutoune@gmail.com> writes:

> The easiest way to achieve similar is to use a manifest file, IMHO.
>
> Let consider the file below named '/tmp/my-emacs-config.scm', then it
> is easy to create a profile (or environment):
>
>    guix package -m /tmp/my-emacs-config.scm -p /tmp/my-profile
>
> and the Emacs living in this very profile should be correctly setup-ed
> for your needs. Therefore let source the profile or whatever and done.
> :-)

At first I though guix would install the packages, but Emacs would be
unable to look them up on the store. I didn't realize the final profile
would setup Emacs to correctly look them up.

So I was missing an 'emacsWithPackage' tool that would do that binding,
but it doesn't actually seem necessary.

Using a manifest seems a good solution, I'll try it out.

Thanks for the code snippet too. Hopefull I'll get it working and
write/blog about it.

:)

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 832 bytes --]

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

end of thread, other threads:[~2020-01-28 17:00 UTC | newest]

Thread overview: 11+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2020-01-22  4:09 Guix as a package manager for Emacs EuAndreh via
2020-01-22  9:43 ` Pierre Neidhardt
2020-01-22 11:47   ` EuAndreh via
2020-01-22 14:14 ` zimoun
2020-01-22 14:17   ` zimoun
2020-01-22 15:11     ` John Soo
2020-01-23 15:26       ` zimoun
2020-01-28 15:32     ` EuAndreh via
2020-01-28 15:34   ` EuAndreh via
2020-01-23 15:23 ` zimoun
2020-01-28 15:22   ` EuAndreh via

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