This file provides guidance to Claude Code (claude.ai/code) when working with code in this repository.
Runeword Terminal is a reproducible terminal environment built with Nix flakes. It wraps Alacritty with a fully configured shell ecosystem (Zsh, Tmux, Starship, and 40+ CLI tools) into a single deployable unit. It supports Linux and macOS.
Enter the dev shell first: nix develop
From within the dev shell:
dev— Run Alacritty in development mode (symlinks config for live reload)bdl— Run Alacritty in bundled mode (config copied into Nix store, requires rebuild)tools <name>— Run a binary from the tools packageh— Show help
Building and running directly:
nix build— Build the bundled terminal packagenix run .— Run bundled modeTERMINAL_CONFIG_DIR="$PWD/config" nix run .#dev --impure— Run dev mode without dev shell
Pre-commit hooks via lefthook (remote config from github:Runeword/lefthook):
- Nix:
nixfmt-rfc-style(nixfmt with RFC style) - Shell:
shfmt(2-space indent per .editorconfig) - Go: go formatting and linting
- TOML:
taplo - YAML: yaml formatting
- Shell analysis:
shellcheck,shellharden(available in dev shell) - Commit messages: auto-msg module
All formatters are available in the dev shell. Run them manually:
nixfmt <file.nix>shfmt -w <file.sh>taplo fmt <file.toml>
The flake produces a wrapped Alacritty terminal with all tools on its PATH:
- Development mode (
apps.dev):configPathis read from$TERMINAL_CONFIG_DIRenv var at build time. Config files are symlinked, so edits take effect immediately without rebuild. - Bundled mode (
apps.default/packages.default):configPathpoints to./configin the Nix store. Fully isolated but requiresnix buildafter config changes.
There's also a Home Manager module (homeManagerModules.default) for integration into NixOS/home-manager configurations.
flake.nix is the entry point. The build flow:
flake.nixdefinesmkTools(packages + wrappers) andmkTerminal(importswrappers/alacritty.nixwith tools on PATH)wrappers/alacritty.nixwraps Alacritty with fonts, shell (Zsh), and the combinedtoolsPATHtools=packages/(raw CLI tools + custom packages) +wrappers/(config-wrapped tools)- Each wrapper (e.g.,
wrappers/zsh.nix) usespkgs.symlinkJoin+pkgs.makeWrapperto inject config paths and env vars into the tool lib/files.nixprovidessync/link/copyhelpers that decide whether to symlink (dev mode) or copy (bundled mode) config files based on whetherrootPathstarts with/nix/store
Flake outputs also expose lib.mkTerminal and lib.mkTools for external consumers, and packages.tools for running individual tools via nix run .#tools.
config/— All dotfiles and shell configuration (alacritty, bash, bat, claude, delta, direnv, ignore, navi, nvim-fzf, readline, ripgrep, shell, starship, tmux, zsh)config/shell/— Shared shell config loaded by both zsh and bash:aliases.sh,variables.sh,xdg.sh, andfunctions/directory with per-topic function files (git.sh, tmux.sh, nix.sh, fm.sh, etc.)wrappers/— Nix expressions that wrap each tool with its config: zsh, tmux, bat, fd, ripgrep, bash, starship, delta, navi, nvim-fzf, claude. Each.nixfile follows the same pattern: symlinkJoin + makeWrapperpackages/— Package lists split intocommons.nix(cross-platform),linux.nix,darwin.nix, andcustom/(custom-built packages like firefox-mcp and git-branches)devshells/— Development shell definitions:terminal.nix(dev/bdl/tools commands),languages.nix(Go),lefthook.nix(formatting/linting hooks)overlays/— Nixpkgs overlays pinning specific packages to other nixpkgs versions (awscli2 to 24.05, tmux to 25.11) and overriding firebase-tools build configmodules/terminal.nix— Home Manager module exposingprograms.terminal.enableandprograms.terminal.configPathlib/files.nix— File sync utilities that bridge dev/bundled modes
Zsh (config/zsh/.zshrc) loads in this order:
- Deferred compinit setup (loaded on first tab press or after 1s background timer)
- Key mappings (KEYS associative array)
- Zsh plugins (from
$NIX_OUT_SHELL/.config/zsh/plugins/) - Zsh hooks (precmd for newline before prompt)
- XDG base directory setup (
shell/xdg.sh) - Environment variables (
shell/variables.sh) - History config, dircolors, autosuggestions
- Word style, completion setup, keybindings
- Shell aliases (
shell/aliases.sh) - NVM (Node Version Manager)
- Shell functions (all files from
shell/functions/) - Custom widgets and key bindings (tab handler, leader aliases, fzf)
- Starship prompt init (cached)
- Direnv hook (cached)
- Deferred plugins (navi, zoxide, fzf — loaded on first precmd)
- Nix files use
nixfmt-rfc-styleformatting - Shell scripts must be POSIX-compliant
- Shell scripts use 2-space indentation
- Shell functions are prefixed with
__(e.g.,__git_add,__tmux_kill) - Shell function files are organized by topic in
config/shell/functions/ - Multiple nixpkgs inputs (unstable, 24.05, 25.11) are used via overlays to pin specific package versions