[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Guix as a package manager for Emacs
From: |
zimoun |
Subject: |
Re: Guix as a package manager for Emacs |
Date: |
Wed, 22 Jan 2020 15:14:26 +0100 |
Hi,
On Wed, 22 Jan 2020 at 05:10, EuAndreh via <address@hidden> 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---