An Emacs major mode for editing Nix expressions, powered by the new built-in tree-sitter support in Emacs 29 and the community-maintained Nix tree-sitter grammar.
nix-ts-mode
only provides syntax highlighting for now, but will eventually support other tree-sitter powered features such as sexp-movement and smart indenting.
After installing, enable the mode for Nix files like so:
(require 'nix-ts-mode)
(add-to-list 'auto-mode-alist '("\\.nix\\'" . nix-ts-mode))
Or with use-package
:
(use-package nix-ts-mode
:mode "\\.nix\\'")