all messages for Guix-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: zimoun <zimon.toutoune@gmail.com>
To: EuAndreh <eu@euandre.org>
Cc: help-guix <Help-Guix@gnu.org>
Subject: Re: Guix as a package manager for Emacs
Date: Wed, 22 Jan 2020 15:14:26 +0100	[thread overview]
Message-ID: <CAJ3okZ3kDVFmt7+7aMtxP6Uk8dbjFk9R0-50XLK1Fw2ayaR1yA@mail.gmail.com> (raw)
In-Reply-To: <87pnfcf7y5.fsf@euandre.org>

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

  parent reply	other threads:[~2020-01-22 14:14 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
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 [this message]
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

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=CAJ3okZ3kDVFmt7+7aMtxP6Uk8dbjFk9R0-50XLK1Fw2ayaR1yA@mail.gmail.com \
    --to=zimon.toutoune@gmail.com \
    --cc=Help-Guix@gnu.org \
    --cc=eu@euandre.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/guix.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.