complete-computing-environment/configure_packaging.org

106 lines
3.1 KiB
Org Mode

:PROPERTIES:
:ID: cce/configure_packaging
:END:
#+TITLE: Configure Packaging
#+filetags: :CCE:
#+PROPERTY: header-args :mkdirp yes :results none
#+PROPERTY: header-args:emacs-lisp :tangle packaging.el
#+PROPERTY: header-args:yaml :tangle roles/endpoint/tasks/packaging.yml
#+ARCOLOGY_KEY: cce/packaging
#+ARCOLOGY_ALLOW_CRAWL: t
#+ARROYO_EMACS_MODULE: packaging
This is the package manager configuration for [[id:cce/cce][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.
#+begin_src emacs-lisp
(provide 'cce/packaging)
#+end_src
* package.el
#+begin_src emacs-lisp
(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)
#+end_src
#+BEGIN_SRC yaml
- 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
#+END_SRC
* straight.el
#+begin_src emacs-lisp :tangle no
(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))
#+end_src
* 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=.
#+begin_src emacs-lisp
(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)))
#+end_src
#+begin_src emacs-lisp
(install-pkg 'use-package)
(require 'use-package)
(setq use-package-always-ensure t
use-package-compute-statistics t)
#+end_src