Fork 0
The arcology is a web publishing system for org-roam written in the literate fashion in phoenix elixir and emacs lisp
Go to file
Ryan Rix ef88ee8c3b nix-shell needs all our deps 2021-07-06 18:34:20 -07:00
assets remove the references to Foundation for Sites 2021-07-06 18:33:32 -07:00
priv/lisp move lisp in to priv directory for release to use 2021-01-27 15:47:39 -08:00
.envrc splatter 2021-07-05 22:09:56 -07:00
.gitignore splatter 2021-07-05 22:09:56 -07:00
404.org add the 404 page and route to it 2020-11-14 16:46:39 -08:00
Makefile move lisp in to priv directory for release to use 2021-01-27 15:47:39 -08:00
README.org nix-shell needs all our deps 2021-07-06 18:34:20 -07:00
aesthetics.org remove the references to Foundation for Sites 2021-07-06 18:33:32 -07:00
arcology.org Set up Phoenix.PubSub.Server 2021-07-06 18:33:55 -07:00
arcology_db.org update some links 2021-07-05 22:09:55 -07:00
arcology_media_store.org stub media store 2021-01-12 18:54:04 -08:00
arcology_page.org splatter 2021-07-05 22:09:56 -07:00
arcology_roam.org fix incorrect title 2021-02-26 19:18:11 -08:00
arcology_sitemap.org sitemap needs a bit more time to settle 2021-01-12 19:01:11 -08:00
arcology_web.org rip out foundation css 2021-01-12 18:51:18 -08:00
deploying.org more closely link the version references 2021-02-26 19:18:11 -08:00
inotify-tools.org update some links 2021-07-05 22:09:55 -07:00
link_routers.org replace dangling roam:links with 404 pages 2021-02-26 15:33:40 -08:00
mix.lock Set up Phoenix.PubSub.Server 2021-07-06 18:33:55 -07:00
page_controller.org remove the references to Foundation for Sites 2021-07-06 18:33:32 -07:00
phoenix.org Set up Phoenix.PubSub.Server 2021-07-06 18:33:55 -07:00
sitemap.org add sitemap template, should rebase this 2020-11-14 16:52:00 -08:00
testing.org add ARCOLOGY_KEYs 2020-10-11 20:09:09 -07:00
usersocket.org add ARCOLOGY_KEYs 2020-10-11 20:09:09 -07:00


Arcology: An Org Roam Publishing System

The Arcology is a system for publishing my org-mode documents to the web, an important component of Ryan Rix's Complete Computing Environment. Rather than a pure static-site design, a directory full of "compiled HTML", the Arcology aims to provide just enough dynamicity to make publishing on the web simple, transparent, and powerful. Arcology uses the same database caching that Org Roam uses with some custom extensions to provide a web-view of a subset of documents in my knowledge base, and "indieweb" facilities around this like microformats, webmentions, indieauth, and some day a full ActivityPub implementation for my Journal and a "link blog" of my Archive posts.

This project is a repository of Org Mode formatted documents which describe and implement a web service written in Elixir using the Phoenix Framework. Rather than directly editing the source code, these documents are edited instead source code, justification and the links between disparate modules and data-flows expressed in text as well as code.

Table of Contents


There is a Makefile to make it easier to tangle the files. You will need Emacs and Org-mode installed for this to work. Some day all of this will be in Mix tasks that can contain the whole set of dependencies.

make tangle will tangle any org document which is newer than a handle left in _build. It's important to keep your tangled documents up to date with the file system, but for development it's likely that you're sending the Elixir code to a running IEx session, there will be an org-mode documentation providing for this at some point soon.

make init will tangle, download dependencies, and compile them.

Nix Shell for Development Environment

{ pkgs ? import <nixpkgs> {} }:

pkgs.mkShell {
  packages = with pkgs; [

Developing in a REPL and a Babel doc

Arcology development requires a postgres database with a database called arcology_dev. run shell:mix ecto.setup (or click on that link!)

Executing this code will allow you to send the org-babel block under point to the REPL. I don't know how that handles noweb, blocks but it kinda works. Most of the time, I rely on automatically tangling and recompiling.

(use-package eval-in-repl
  (require 'eval-in-repl-ielm)
  ; i disable transient mark mode
  (defun eir-eval-in-iex ()
    "Provides eval-in-repl for Elixir."
    ;; Define local variables
    (let* ()
      (eir-repl-start "\\*Alchemist-IEx\\*" #'alchemist-iex-run t)
      (eir-send-to-iex (buffer-substring-no-properties (point) (mark)))))

  (setq eir-repl-placement 'left)
  (setq eir-jump-after-eval nil)
  (setq eir-ielm-eval-in-current-buffer t))

(use-package org-babel-eval-in-repl
  :after ob
  (add-to-list 'ober-org-babel-type-list '("elixir" . (eval-in-repl-iex eir-eval-in-iex)))
  (evil-define-key 'normal 'org-mode-map (kbd "C-<return>") #'ober-eval-in-repl)
  (evil-define-key 'normal 'org-mode-map (kbd "M-<return>") #'ober-eval-block-in-repl))

(use-package alchemist)

Alchemist can run an IEx shell with iex -S mix phx.server">iex -S mix phx.server, and run tests with mix test.watch">mix test.watch.

Run this with Alt-Return to disable colors and see the IEx shell in action. Many "naked" code blocks can be evaluated in this fashion, but EIR doesn't support noweb blocks.

alias Arcology.{Repo,Roam,Page}
IEx.configure(colors: [enabled: false])

use-package org-auto-tangle and enable org-auto-tangle-mode to get automatic tangling.

To trigger a recompile in iex after tangle, execute this block. It'll also touch the files which the Makefile checks for "up-to-date"-ness in the tangle task which'll need to be run by build scripts. This code is kind of cursed; you see, org-babel has a pre-tangle hook which isn't so useful, but current-buffer is the org-mode doc. The post-tangle hook is ran in each output file. So this cursed code runs an idle timer!

(defun arcology/idle-file-for-make-command ()
  (run-with-idle-timer 1 nil #'arcology/recompile-iex))

(defun arcology/recompile-iex ()
  (let* ((file (or org-src-source-file-name (buffer-file-name)))
         (touch-file (replace-regexp-in-string "\\([^/]+\\)\\.org$" "_build/\\1.touch" file)))
    (when (s-contains? "arcology" file)
      (message "touch %s" touch-file)
      (call-process-shell-command (format "touch %s" touch-file))
      (eir-send-to-iex "recompile"))))

(add-hook #'org-babel-pre-tangle-hook #'arcology/idle-file-for-make-command)