Architecture Overview
Jotain is organised into distinct layers, each with a clear responsibility.File Structure
Layers
Emacs Lisp Layer
The Elisp configuration is split into three parts:-
early-init.el— loaded beforepackage.el, before the first frame, beforeinit.el. Handles anything that must happen that early: the startup GC threshold,use-package-always-ensure, frame chrome defaults, native-comp and eln-cache redirection, terminal aliases. -
init.el— tiny entry point. Registers MELPA/NonGNU ELPA as fallback archives, putslisp/on the load-path, pointscustom-fileatvar/custom.el(write-only — never loaded back), andrequires each module in order. Archive refresh is off the startup path entirely — there is no background warm-up; archives are fetched only whenpackage-installfinds an empty cache, or on an explicitM-x package-refresh-contents. -
lisp/init-*.el— one file per concern. See Modules for the full list and their responsibilities.
Nix Layer
The Nix layer provides reproducible Emacs builds:-
emacs.nix— wraps the git-based attrs fromnix-community/emacs-overlay(git/unstable/igc;unstableis the default) or nixpkgs’ defaultemacsattribute (mainline, the cache-parity canary), with the supported build flags exposed as arguments. The build matrix is deliberately narrow: pgtk/Wayland GUI or terminal-only on Linux, patched NS GUI or terminal-only on Darwin — everything else is asserted away. A cache-parity invariant guarantees the Linux and terminal builds produce the same store paths as the matching prebuilt attrs, so their default-rev builds are cache hits against Hydra andnix-community.cachix.org. Customrevpins and the Darwin GUI (whose nix-giant patches are on by default) run throughoverrideAttrsand intentionally rebuild from source. -
default.nix— flake-compat wrapper for the default package set. -
module.nix— Home Manager module that runs Jotain as a user-session Emacs daemon (services.jotain), generates a desktop entry foremacsclient, and can install itself asEDITOR/VISUAL. Supports systemd on Linux and launchd on macOS;services.jotain.packageswaps in any other Jotain-shaped distribution.
Development Layer
devenv.nix— development shell, tooling only: there is noemacsbinary in it (see its top-of-file note). It ships Nix tooling and linters (nil,nixfmt-rfc-style,treefmt,statix,deadnix), the language servers and CLIs the Elisp config shells out to, the docs toolchain, and the fonts the UI config probes. Build and launch the editor withjust run-built(see the current-state note in Launching Emacs).Justfile— every recipe you run day-to-day:run-built/run-built-debug(build via Nix, then launch),check,test, thebuild-*matrix,fmt,update,verify,clean,clean-all. The direct-launch and in-shell compile recipes (run,debug,tty,check-elisp,compile,bench, …) are disabled stubs; their coverage lives in theelisp-lint/elisp-compile/elisp-testflake checks.- Pinning —
flake.lockis the single source of truth;default.nixandemacs.nixread it directly viafetchTarballso non-flakenix-buildconsumers get the same pin.devenv.yamlmirrors the flake’s shared input revs (nixpkgs,treefmt-nix,emacs-overlay), andjust updatekeepsdevenv.lockin lockstep.