[emacs-berlin] Reproducible Emacs installations

jman emacs-berlin at storiepvtride.it
Mon Dec 21 18:22:06 UTC 2020

Hello folks!

A little while ago I wanted to solve a puzzle: a complete and
reproducible unattended emacs installation from scratch.
This is useful to set up emacs on different machines or (in my case)
provision your workstation using tools such as Ansible or Nix
packages. And emacs is one of the first thing I need to have immediately

Fermin (hi fermin!) gave some hints [0] and from there I finally reached
a good enough solution. I'm using `use-package` and didn't want
to also install `straight` (my config is confusing enough already ^_^).

Here's the relevant snippet (commented):

;; add MELPA repository
(require 'package)
(add-to-list 'package-archives
  '("melpa" . "https://melpa.org/packages/") t)

;; fetch the list of packages available *now*
(unless package-archive-contents

;; if not installed, force installation of "use-package" *now*
(unless (package-installed-p 'use-package)
  (package-install 'use-package))

;; install a new package automatically if not already present
(require 'use-package-ensure)
 (setq use-package-always-ensure t)

from now on any package will be downloaded and installed with:

(use-package a-new-package)

here's a link [1] if anyone wants to have a look (first 20
lines are relevant).

As usual, comments and suggestions are welcome.

happy hacking!

[0] https://mailb.org/pipermail/emacs-berlin/2020/000752.html
[1] https://git.sr.ht/~jman/dotfiles/tree/master/item/emacs/.config/emacs/init.el

More information about the emacs-berlin mailing list