complete-computing-environment/configure_packaging.org

3.1 KiB

Configure Packaging

This is the package manager configuration for CCE: The Complete Computing Environment

I use MELPA and GNU ELPA to get my Emacs packages, as much as I can. It seems like a lot of folks are heading towards using straight.el or using another thing which pulls in packages directly from the sources, but I use these for now, unless I can't.

(provide 'cce/packaging)

package.el

(package-initialize)

(add-to-list 'package-archives
             '("gnu" . "http://elpa.gnu.org/packages/") t)
(add-to-list 'package-archives
             '("melpa" . "http://melpa.org/packages/") t)
- name: emacs is installed
  dnf:
    name: emacs
    state: installed
  when: ansible_pkg_mgr=="dnf"
  tags:
  - install-emacs

- name: emacs is installed
  apt:
    name: emacs
    state: present
  when: ansible_pkg_mgr=="apt"
  tags:
  - install-emacs

- name: emacs is installed
  shell:
    creates: /data/data/com.termux/files/usr/bin/emacs
    cmd: pkg install -y emacs
  when: ansible_pkg_mgr=="unknown"
  tags:
  - install-emacs

- name: org-mode installed
  become: "{{needs_become_deescalate}}"
  become_user: "{{local_account}}"
  shell: emacs --batch -q --eval "(progn (package-initialize) (setq package-archives '((\"org\" . \"http://orgmode.org/elpa/\"))) (setq package-pinned-archives '((org . \"org\") (org-plus-contrib . \"org\"))) (package-refresh-contents) (package-install 'org) (package-install 'org-plus-contrib))"
  register: org_install
  changed_when: not org_install.stdout == ""
  tags:
  - install-emacs

straight.el

(defvar bootstrap-version)
(let ((bootstrap-file
       (expand-file-name "straight/repos/straight.el/bootstrap.el" user-emacs-directory))
      (bootstrap-version 5))
  (unless (file-exists-p bootstrap-file)
    (with-current-buffer
        (url-retrieve-synchronously
         "https://raw.githubusercontent.com/raxod502/straight.el/develop/install.el"
         'silent 'inhibit-cookies)
      (goto-char (point-max))
      (eval-print-last-sexp)))
  (load bootstrap-file nil 'nomessage))

use-package

I want to use use-package for most packages which I currently install using this hand-built function, which I plan to only use for … installing use-package.

(setq cce/did-refresh-packages nil)
(defun install-pkg (pkg)
  (unless (package-installed-p pkg)
    (unless cce/did-refresh-packages
      (package-refresh-contents)
      (setq cce/did-refresh-packages t))
    (package-install pkg)))
(install-pkg 'use-package)
(require 'use-package)
(setq use-package-always-ensure t
      use-package-compute-statistics t)