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), refreshes archive contents on the first run, andrequires each module in order. -
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 nixpkgs’ defaultemacsattribute (default), the git-based attrs fromnix-community/emacs-overlay(git/unstable/igc), orpkgs.emacs-macportwith the full set of build flags exposed as arguments. A cache-parity invariant guarantees thatimport ./emacs.nix {}produces the same store path aspkgs.emacs(and each overlay variant the matching overlay attr), so default-rev builds are cache hits against Hydra andnix-community.cachix.org. Only customrevpins and Darwin patches run throughoverrideAttrsand intentionally rebuild from source. -
emacs-jylhis.nix— builds the pinnedgithub:jylhis/emacsMeson fork. The flake exposes it as a non-default opt-in backend so consumer flakes can install the same Jotain setup on the fork without changing the stable default. -
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, withservices.jotain.emacsBackend = "jylhis"for the fork backend.
Development Layer
devenv.nix— development shell. Provides the local Emacs build (soemacsin the shell matchesjust build-bare), Nerd Fonts,nil,nixfmt-rfc-style, andtreefmt. Enables the customlanguages.emacs-lispmodule fromnix/devenv-emacs-lisp.nix, which provides Emacs +eask-cli(withellspandelsaoff by default).Justfile— every recipe you run day-to-day:run,debug,tty,check,compile,test, thebuild-*matrix,fmt,update,verify,clean,clean-all.- 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), andjust updatekeepsdevenv.lockin lockstep.