home

Unnamed repository; edit this file 'description' to name the repository.
Log | Files | Refs | README | LICENSE

commit adba298a2383f9d918148bd18e7d649e216e4521
parent 9115ecab812c6dff0c1ceeb22ced62d09e9f2cc2
Author: Vincent Demeester <vincent@sbr.pm>
Date:   Fri, 27 Mar 2020 16:27:16 +0100

Update docs/ folder and Makefile…

… to publish stuff on `www` 🎯

Signed-off-by: Vincent Demeester <vincent@sbr.pm>

Diffstat:
M.gitignore | 5+++--
MMakefile | 38+++++++++++++++++++++++++++++---------
Adocs/.setupfile.org | 4++++
Adocs/emacs.old.org | 118+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Ddocs/emacs.org | 118-------------------------------------------------------------------------------
Mdocs/mails.org | 2+-
Apublish.el | 52++++++++++++++++++++++++++++++++++++++++++++++++++++
7 files changed, 207 insertions(+), 130 deletions(-)

diff --git a/.gitignore b/.gitignore @@ -2,4 +2,5 @@ result home.nix *.retry -assets/machines.nix- \ No newline at end of file +assets/machines.nix +docs/index.org+ \ No newline at end of file diff --git a/Makefile b/Makefile @@ -1,29 +1,49 @@ +# Makefile for home + +.PHONY: all build build-www clean publish pull switch update + +EMACS = +ifndef EMACS +EMACS = "emacs" +endif + +PUBLISH_FOLDER = +ifndef PUBLISH_FOLDER +PUBLISH_FOLDER=~/desktop/sites/beta.sbr.pm +endif + all: build -.PHONY: update update: nix-channel --update -.PHONY: pull pull: (cd overlays/emacs-overlay && git pull --rebase) -.PHONY: assets assets: cp -Rv ~/sync/nixos/machines.nix assets/ -.PHONY: build build: assets home-manager build -.PHONY: switch switch: assets home-manager switch -.PHONY: clean clean: unlink result -.PHONY: publish -publish: - cp *.org ~/desktop/org/technical/configurations/ +clean-www: + @rm -rvf *.elc + @rm -rv ~/.org-timestamps/* + +build-www: ${HOME}/src/www/publish-common.el publish.el + @echo "Publishing... with current Emacs configurations." + ${EMACS} --batch --directory ${HOME}/.emacs.d/lisp/ \ + --load ${HOME}/src/www/publish-common.el --load publish.el \ + --funcall org-publish-all + +${HOME}/src/www/Makefile: ${HOME}/src/www/ +${HOME}/src/www/publish-common.el: ${HOME}/src/www/ + +${HOME}/src/www/: + test -d ${HOME}/src/www || git clone git@git.sr.ht:~vdemeester/www.git ${HOME}/src/www/ diff --git a/docs/.setupfile.org b/docs/.setupfile.org @@ -0,0 +1,4 @@ +#+AUTHOR: Vincent Demeester +#+KEYWORDS: configuration +#+OPTIONS: toc:t +#+EXCLUDE_TAGS: noexport diff --git a/docs/emacs.old.org b/docs/emacs.old.org @@ -0,0 +1,118 @@ +#+TITLE: Vincent Demeester's .emacs.d +#+SETUPFILE: ./.setupfile.org + +* Overview +:PROPERTIES: +:CUSTOM_ID: h:d95d2079-2aee-4be4-b6bd-d89de96e7033 +:END: + +** Canonical links to this document +:PROPERTIES: +:CUSTOM_ID: h:0a080da3-bcc6-42a1-83ef-5d1ed6123cc4 +:END: + +** What is this +:PROPERTIES: +:CUSTOM_ID: h:fa787d18-1a0c-4312-bc07-22318c645daa +:END: + +This is a try at merging [[https://github.com/vdemeester/emacs-config.git][~vdemeester/emacs-config~]] and [[https://github.com/vdemeester/home.git][~vdemeester/home~]] repository by +having the emacs configuration written in there. Once this is complete, +[[https://github.com/vdemeester/emacs-config.git][~vdemeester/emacs-config~]] should be archived. + +* Nix-ies +:PROPERTIES: +:CUSTOM_ID: h:8bc69da9-b49c-4ddd-a6c9-b944aad993a1 +:END: + +This is where the magic happens, when using [[https://nixos.org/nix/][~nix~]] or [[https://nixos.org][NixOS]] with [[https://github.com/rycee/home-manager][~home-manager~]]. In a gist +we will create a set of nix files that tangle, get dependencies and generate the correct +emacs package with the packages used inside the configuration. This means, if I add a +=(use-package magit)= in my configuration, and I tangle / re-execute this script(s), I now +have a new packaged installed as part of my Emacs package. This is *heavily* inspired by +[[https://matthewbauer.us/bauer/][Matthew Bauer's bauer]] emacs configuration. + +** Required lisp libraries +:PROPERTIES: +:header-args: :tangle ~/.emacs.d/lisp/use-package-list.el +:CUSTOM_ID: h:316fd3ee-ab99-4f01-ba5a-1a91c54bc334 +:END: + +We need a way to list packages used in the configuration using ~use-package~. This is +coming straight from [[https://matthewbauer.us/bauer/][Matthew Bauer's bauer]]. + +#+begin_src emacs-lisp +;;; use-package-list.el --- List use-package declarations in config file + +;; Copyright (C) 2017 Matthew Bauer + +;; Author: Matthew Bauer <mjbauer95@gmail.com> + +;; This file is NOT part of GNU Emacs. + +;;; Commentary: + +;; ‘ensure’ packages at compile time. + +;;; Code: + +(require 'json) +(require 'use-package) +(require 'package) +(eval-when-compile + (require 'cl)) + +(defun use-package-list (script) + "Count use-package declarations listed in SCRIPT." + + (defvar use-package-list--is-running t) + (lexical-let ((use-package-verbose t) + (use-package-debug t) + (use-package-always-ensure nil) + (use-package-always-defer t) + (use-package-list--packages nil) + (use-package-ensure-function 'ignore)) + (advice-add 'use-package + :before (lambda (name &rest args) + (unless (or (and (member :disabled args) + (plist-get args :disabled)) + (and (member :ensure args) + (not (plist-get args :ensure))) + (and (not (member :ensure args)) + (package-built-in-p name))) + (when (and (member :ensure args) + (not (eq (plist-get args :ensure) t)) + (symbolp (plist-get args :ensure))) + (setq name (plist-get args :ensure))) + (add-to-list 'use-package-list--packages name)))) + + (advice-add 'use-package-handler/:defer + :around (lambda (x name keyword arg rest state) + (let ((body (use-package-process-keywords name rest + (plist-put state :deferred t))) + (name-string (use-package-as-string name))) + (dolist (command + (delete-dups (plist-get state :commands))) + (fset command (lambda (&rest args)))) + body))) + + (advice-add 'use-package-load-name :override #'ignore) + + (load script nil nil t) + + (princ (json-encode use-package-list--packages)) + + use-package-list--packages)) + +(provide 'use-package-list) +;;; use-package-list.el ends here +#+end_src + +The idea is to run some like the following. + +#+begin_src bash :tangle no +emacs --batch --quick \ + -L /nix/store/acm9rskhx237xb16zdy7vx6r1m5n8q58-emacs-packages-deps/share/emacs/site-lisp/elpa/use-package-20191126.2034/use-package-* \ + -l /home/vincent/.emacs.d/lisp/use-package-list.el \ + --eval "(use-package-list \"/home/vincent/.emacs.d/init.el\")" +#+end_src diff --git a/docs/emacs.org b/docs/emacs.org @@ -1,118 +0,0 @@ -#+SETUPFILE: ../_setup.org -#+TITLE: Vincent Demeester's .emacs.d - -* Overview -:PROPERTIES: -:CUSTOM_ID: h:d95d2079-2aee-4be4-b6bd-d89de96e7033 -:END: - -** Canonical links to this document -:PROPERTIES: -:CUSTOM_ID: h:0a080da3-bcc6-42a1-83ef-5d1ed6123cc4 -:END: - -** What is this -:PROPERTIES: -:CUSTOM_ID: h:fa787d18-1a0c-4312-bc07-22318c645daa -:END: - -This is a try at merging [[https://github.com/vdemeester/emacs-config.git][~vdemeester/emacs-config~]] and [[https://github.com/vdemeester/home.git][~vdemeester/home~]] repository by -having the emacs configuration written in there. Once this is complete, -[[https://github.com/vdemeester/emacs-config.git][~vdemeester/emacs-config~]] should be archived. - -* Nix-ies -:PROPERTIES: -:CUSTOM_ID: h:8bc69da9-b49c-4ddd-a6c9-b944aad993a1 -:END: - -This is where the magic happens, when using [[https://nixos.org/nix/][~nix~]] or [[https://nixos.org][NixOS]] with [[https://github.com/rycee/home-manager][~home-manager~]]. In a gist -we will create a set of nix files that tangle, get dependencies and generate the correct -emacs package with the packages used inside the configuration. This means, if I add a -=(use-package magit)= in my configuration, and I tangle / re-execute this script(s), I now -have a new packaged installed as part of my Emacs package. This is *heavily* inspired by -[[https://matthewbauer.us/bauer/][Matthew Bauer's bauer]] emacs configuration. - -** Required lisp libraries -:PROPERTIES: -:header-args: :tangle ~/.emacs.d/lisp/use-package-list.el -:CUSTOM_ID: h:316fd3ee-ab99-4f01-ba5a-1a91c54bc334 -:END: - -We need a way to list packages used in the configuration using ~use-package~. This is -coming straight from [[https://matthewbauer.us/bauer/][Matthew Bauer's bauer]]. - -#+begin_src emacs-lisp -;;; use-package-list.el --- List use-package declarations in config file - -;; Copyright (C) 2017 Matthew Bauer - -;; Author: Matthew Bauer <mjbauer95@gmail.com> - -;; This file is NOT part of GNU Emacs. - -;;; Commentary: - -;; ‘ensure’ packages at compile time. - -;;; Code: - -(require 'json) -(require 'use-package) -(require 'package) -(eval-when-compile - (require 'cl)) - -(defun use-package-list (script) - "Count use-package declarations listed in SCRIPT." - - (defvar use-package-list--is-running t) - (lexical-let ((use-package-verbose t) - (use-package-debug t) - (use-package-always-ensure nil) - (use-package-always-defer t) - (use-package-list--packages nil) - (use-package-ensure-function 'ignore)) - (advice-add 'use-package - :before (lambda (name &rest args) - (unless (or (and (member :disabled args) - (plist-get args :disabled)) - (and (member :ensure args) - (not (plist-get args :ensure))) - (and (not (member :ensure args)) - (package-built-in-p name))) - (when (and (member :ensure args) - (not (eq (plist-get args :ensure) t)) - (symbolp (plist-get args :ensure))) - (setq name (plist-get args :ensure))) - (add-to-list 'use-package-list--packages name)))) - - (advice-add 'use-package-handler/:defer - :around (lambda (x name keyword arg rest state) - (let ((body (use-package-process-keywords name rest - (plist-put state :deferred t))) - (name-string (use-package-as-string name))) - (dolist (command - (delete-dups (plist-get state :commands))) - (fset command (lambda (&rest args)))) - body))) - - (advice-add 'use-package-load-name :override #'ignore) - - (load script nil nil t) - - (princ (json-encode use-package-list--packages)) - - use-package-list--packages)) - -(provide 'use-package-list) -;;; use-package-list.el ends here -#+end_src - -The idea is to run some like the following. - -#+begin_src bash :tangle no -emacs --batch --quick \ - -L /nix/store/acm9rskhx237xb16zdy7vx6r1m5n8q58-emacs-packages-deps/share/emacs/site-lisp/elpa/use-package-20191126.2034/use-package-* \ - -l /home/vincent/.emacs.d/lisp/use-package-list.el \ - --eval "(use-package-list \"/home/vincent/.emacs.d/init.el\")" -#+end_src diff --git a/docs/mails.org b/docs/mails.org @@ -1,6 +1,6 @@ -#+SETUPFILE: ../_setup.org #+TITLE: My email setup #+SUBTITLE: A very opiniated mail setup +#+SETUPFILE: ./.setupfile.org #+BEGIN_abstract This article presents my opinionated email setup, client side. By opinionated I mean that diff --git a/publish.el b/publish.el @@ -0,0 +1,52 @@ +;;; publish.el --- Publish home project -*- lexical-binding: t; -*- +;; Author: Vincent Demeester <vincent@sbr.pm> + +;;; Commentary: +;; This script will convert the org-mode files in this directory into +;; html. + +;;; Code: +(require 'package) +(require 'publish-common) + +;; OrgPublishProjects +(setq org-publish-project-alist + `(("configurations" + :base-directory "docs" + :base-extension "org" + :recursive t + :publishing-function org-html-publish-to-html + :publishing-directory "../www/public/configurations" + :exclude ,(regexp-opt '("README.org" "draft")) + :auto-sitemap t + :with-footnotes t + :with-toc t + :with-drawers t + :sitemap-filename "index.org" + :sitemap-title "Configurations" + :sitemap-style tree + :sitemap-sort-files anti-chronologically + :sitemap-format-entry sbr/org-sitemap-format-entry + :sitemap-function sbr/org-publish-sitemap + :html-head-include-scripts nil + :html-head-include-default-style nil + :html-head ,sbr-website-html-head + :html-preamble sbr-website-html-preamble + :html-postamble ,sbr-website-html-postamble) + ("images" + :base-directory "docs/images" + :base-extension ,site-attachments + :publishing-directory "../www/public/images" + :publishing-function org-publish-attachment + :recursive t) + ("assets" + :base-directory "docs/assets" + :base-extension ,site-attachments + :publishing-directory "../www/public/assets" + :publishing-function org-publish-attachment + :recursive t) + ("all" :components ("configurations" "images" "assets")))) +;; -OrgPublishProjects + +(provide 'publish) +;;; publish.el ends here