Keyboard shortcuts

Press ← or → to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

Development — Languages, Editors and Version Control

Purpose

The purpose.development Home-Manager modules describe language support once and render it into every enabled editor. Adding a language should not require editing Zed, VSCode, Helix, and OpenCode separately. The same purpose owns version control, so git and Jujutsu share one user identity and one signing key.

Entry Point

Architecture / Services / Scope

Language modules

Each language is a module created by mkLanguage.nix. A module exposes:

  • enable — toggle support for the language.
  • treesitterPackages — grammars, with an automatic tree-sitter-grammars.tree-sitter-<name> default.
  • extraPackages — tools that are not LSP servers or formatters.
  • lsp — LSP server descriptors.
  • formatters — formatter descriptors.
  • editors — language-level editor metadata such as extension names and language identifiers.
  • allPackages — read-only union of every package the language contributes.

languages.common is enabled by default and owns the shared servers and formatters for config formats, markup, shell, containers, SQL, and infrastructure files (Markdown, JSON, YAML, TOML, CSS, HTML, XML, Dockerfile, Docker Compose, Bash, Terraform, SQL, and spelling).

Descriptors

Every descriptor is self-describing, so editors never hard-code language knowledge:

{
  name = "nixd";              # editor-facing server identifier
  package = pkgs.nixd;        # package placed on PATH
  binary = "nixd";            # optional binary name when it differs from `name`
  args = [ ];                 # launch arguments
  filetypes = [ ".nix" ];     # extensions/globs
  languages = [ "nix" ];      # canonical language ids
  initializationOptions = { };
  settings = { };
  env = { };
  editors = { };              # per-editor overrides, keyed by editor name
  providesFormatting = false;  # server also formats; see below
}

Servers that format

An LSP descriptor may set providesFormatting = true to declare that the server formats the language. Renderers that support language-server formatting then use that server instead of an external formatter descriptor:

  • Zed emits formatter = { language_server = { name = <server>; }; }.
  • Helix sets auto-format = true and omits formatter, so Helix formats with the server.
  • OpenCode has no language-server formatting and keeps using the external formatter descriptor.

This keeps formatting aligned with the server’s own project knowledge, such as the crate edition rust-analyzer passes to rustfmt. A language therefore keeps its external formatter descriptor for editors that cannot format through a server. Capability is always declared explicitly; never inferred from a server’s presence, because many servers (pyright, marksman, autocorrect) do not format.

Servers that currently opt in: rust-analyzer, clangd, gopls, nil, taplo, yaml-language-server, and bash-language-server. Each of these formats with the same engine as the language’s external formatter, so opting in does not change formatting output, except bash-language-server, which passes editor indent and .editorconfig to shfmt.

Editor renderers

Renderers live beside the editor they serve and flatten descriptors across every enabled language:

  • editors/zed/render.nix — lsp settings, languages.*.language_servers, per-language formatters, extensions, and wrapper packages.
  • editors/helix/render.nix — languages.toml language-server, language, and formatter entries.
  • editors/vscode/render.nix — extension lists and settings grouped by profile.
  • editors/ai/render.nix — OpenCode lsp and formatter sections.

The editors.<name> field on a descriptor is the escape hatch for editor quirks (custom commands, formatter flags, language identifiers). Language names are otherwise derived from the canonical id via languages/names.nix, so modules only declare languages = [ "csharp" ], never "C#" and "c-sharp" separately.

Editors

  • Zed — purpose.development.editors.zed.
  • Helix — purpose.development.editors.helix.
  • VSCode — purpose.development.editors.vscode.
  • OpenCode — purpose.development.editors.ai.

Version control

purpose.development.vcs configures git and Jujutsu from the user identity declared once, and signs commits with core.profile.identity.publicKey.

  • Entry point: modules/home-manager/purpose/development/vcs.nix
  • Enabled by default: purpose.development.vcs.enable defaults to purpose.development.enable; set it to false to keep the language tooling without version control.
  • user.email is required: it has no default, and evaluation fails while the module is enabled without it.
  • user.name defaults to the Home-Manager username with the first letter capitalised.
  • user.publicKey defaults to the contents of core.profile.identity.publicKey; when that file is missing the option stays null and signing is skipped instead of failing the build.
  • primaryVCS selects the installed tool set: jujutsu (the default) adds jjui, jj-pre-push, watchman and uses meld as the diff and merge editor, while git adds gitui. Both variants install gh, gh-dash and delta.
  • Signing — when a key is available, git signs by default with the SSH key and verifies against a generated allowed-signers file; Jujutsu signs at push time only (git.sign-on-push) with the same key and the same allowed-signers file.
  • enableJJDescWrapper installs a jj-desc wrapper using ai.aliases.singleTurn. jj-desc is a single-turn, non-agentic LLM consumer: one request, no repeated turns over generated output. Its API-key secret is declared from the provider registry.

Options

Version control

purpose.development.vcs.enable

Typeboolean
Defaultconfig.purpose.development.enable
Exampletrue

Whether to enable vcs.


purpose.development.vcs.enableJJDescWrapper

Typeboolean
Defaultfalse
Exampletrue

Whether to enable jj-desc wrapper.


purpose.development.vcs.primaryVCS

Typeone of "git", "jujutsu"
Default"jujutsu"

The primary version control system to use, this changes the program set that gets installed and configured.


purpose.development.vcs.user.email

Typenull or string
Defaultnull

The email to use for version control operations, this is your commit email.

If this is left empty while this module is enabled, you will receive an eval error.


purpose.development.vcs.user.name

Typestring
Default"home-manager username with capitalisation for the first character"

The name to use for version control operations, this is your commit display name.


purpose.development.vcs.user.publicKey

Typenull or string
Defaultbuiltins.readFile "${config.core.profile.identity.publicKey}"

The SSH key to use for signing commits.


Zed

purpose.development.editors.zed.enable

Typeboolean
Defaultfalse
Exampletrue

Whether to enable Zed editor.


purpose.development.editors.zed.extensions

Typelist of string
Default[ "autocorrect" "catppuccin-icons" "docker-compose" "dockerfile" "editorconfig" "git-firefly" "ini" "log" "nu" "qml" "terraform" "tokyo-night" "toml" "typos" ]

Zed extensions to install. Language modules contribute their own extensions automatically.


purpose.development.editors.zed.extraPackages

Typelist of package
Default[ <derivation autocorrect-2.16.3> <derivation docker-compose-language-service-0.2.0> <derivation dockerfile-language-server-0.15.0> <derivation shellcheck-0.11.0> <derivation shfmt-3.14.1> <derivation libz-1.2.8.2025.03.07> ]

Packages made available to Zed’s wrapper PATH. Language modules contribute their own packages automatically.


purpose.development.editors.zed.installRemoteServer

Typeboolean
Defaulttrue

Install the Zed remote server binary so this machine can be a remote target.


purpose.development.editors.zed.userSettings

Typeattribute set
Default{ }

Settings merged recursively over the module defaults. User values take precedence.


Helix

purpose.development.editors.helix.enable

Typeboolean
Defaultfalse
Exampletrue

Whether to enable Helix Editor.


VSCode

purpose.development.editors.vscode.enable

Typeboolean
Defaultfalse
Exampletrue

Whether to enable Enable VSCode.


OpenCode

purpose.development.editors.ai.enable

Typeboolean
Defaultfalse
Exampletrue

Whether to enable Enable AI Tools & Assistants.


purpose.development.editors.ai.includeDefaults

Typeboolean
Defaulttrue

Whether to include the default set of agents and skills provided by this module. This includes the agents and skills defined in the ./agents and ./skills directories of this module.

Disabling this will result in a minimal setup with only the base configuration for OpenCode and no pre-registered agents or skills.


purpose.development.editors.ai.skills

Typelist of string
Default[ ]
Example'' [ ''${inputs.my-skill-repo}/skills/my-skill ''${self}/skills/another-skill ] ''

List of additional AI skills to add to the global registry. These should be paths to a skill directory, this could be through a flake input or a path in the flake.

These skills will be installed to ~/.agents/skills and will be available to all agents that support the skill system, such as Claude and OpenCode.


purpose.development.editors.ai.tabby.enable

Typeboolean
Defaultfalse
Exampletrue

Whether to enable Tabby agent for tab completion.


Operational Notes / Assumptions

  • Binaries resolve from PATH by default. Hard-coding binary.path in Zed bypasses direnv; descriptors therefore add packages to the editor environment instead of pinning store paths.
  • Launch arguments are shared across editors. Use editors.<name> when an editor needs different flags, for example formatter write flags in OpenCode.
  • A server marked providesFormatting takes precedence over external formatter descriptors in Zed and Helix. Keep the external formatter declared for OpenCode.
  • Zed settings merge recursively. userSettings values take precedence over the module defaults.
  • languages.common is enabled with purpose.development.enable; disable it explicitly when a host should not receive the shared config-format tooling.

References