About a month ago, I was using NixOS 25.05 (stable) on my laptop, and I had a working Emacs with clojure-ts-mode integration. Then I switched to unstable (using flakes), and ever since then, my clojure-ts-mode is broken. For a while I thought it was temporary and would be fixed in a few days, but now, a month later, it’s still broken the same way, so I want to write in and get some advice.
When I open a Clojure file, I get this in *Warnings*:
■ Warning (treesit): Error encountered when installing language grammar: (file-missing Searching for program No such file or directory cc)
And this appears in *Messages*:
Loading /nix/store/3hb42riawl530fi3sx43wf2q3wqndjqf-emacs-pgtk-30.2/share/emacs/site-lisp/site-start (native compiled elisp)...done
For information about GNU Emacs and the GNU system, type C-h C-a.
Making completion list... [2 times]
Installing clojure Tree-sitter grammar
Cloning repository
Compiling library
Error muted by safe_call: (treesit--font-lock-mark-ranges-to-fontify ((1 . 654)) #<treesit-parser for clojure>) signaled (treesit-query-error "Node type error at" 187 "((list_lit . [(comment) (meta_lit) (old_meta_lit)] * . (sym_lit) @_def_symbol . [(comment) (meta_lit) (old_meta_lit)] * . (sym_lit) . [(comment) (meta_lit) (old_meta_lit)] * . (str_lit (str_content) @capture) @_ignore . (_)) (#match \"^def$\" @_def_symbol)) ((list_lit . [(comment) (meta_lit) (old_meta_lit)] * . (sym_lit) @_def_symbol . (comment) * . (meta_lit value: (map_lit (kwd_lit) @_doc-keyword . (str_lit (str_content) @capture) @_ignore))) (#match \"^\\\\(?:def\\\\(?:interface\\\\|m\\\\(?:acro\\\\|ulti\\\\)\\\\|n-?\\\\|once\\\\|protocol\\\\|record\\\\|struct\\\\|t\\\\(?:est-?\\\\|ype\\\\)\\\\)?\\\\|ns\\\\)$\" @_def_symbol) (#equal @_doc-keyword \":doc\")) ((list_lit . [(comment) (meta_lit) (old_meta_lit)] * . (sym_lit) @_def_symbol . [(comment) (meta_lit) (old_meta_lit)] * . (sym_lit) . [(comment) (meta_lit) (old_meta_lit)] * . (str_lit (str_content) @capture) @_ignore) (#match \"^\\\\(?:def\\\\(?:inline\\\\|m\\\\(?:acro\\\\|ulti\\\\)\\\\|n-?\\\\|protocol\\\\)\\\\|ns\\\\)$\" @_def_symbol)) ((list_lit . [(comment) (meta_lit) (old_meta_lit)] * . (sym_lit) @_def_symbol (list_lit . (sym_lit) (vec_lit) * (str_lit (str_content) @capture) @_ignore) *) (#match \"^\\\\(?:def\\\\(?:interface\\\\|protocol\\\\)\\\\)$\" @_def_symbol))" "Debug the query with `treesit-query-validate'")
Error during redisplay: (jit-lock-function 1) signaled (treesit-query-error "Node type error at" 187 "((list_lit . [(comment) (meta_lit) (old_meta_lit)] * . (sym_lit) @_def_symbol . [(comment) (meta_lit) (old_meta_lit)] * . (sym_lit) . [(comment) (meta_lit) (old_meta_lit)] * . (str_lit (str_content) @capture) @_ignore . (_)) (#match \"^def$\" @_def_symbol)) ((list_lit . [(comment) (meta_lit) (old_meta_lit)] * . (sym_lit) @_def_symbol . (comment) * . (meta_lit value: (map_lit (kwd_lit) @_doc-keyword . (str_lit (str_content) @capture) @_ignore))) (#match \"^\\\\(?:def\\\\(?:interface\\\\|m\\\\(?:acro\\\\|ulti\\\\)\\\\|n-?\\\\|once\\\\|protocol\\\\|record\\\\|struct\\\\|t\\\\(?:est-?\\\\|ype\\\\)\\\\)?\\\\|ns\\\\)$\" @_def_symbol) (#equal @_doc-keyword \":doc\")) ((list_lit . [(comment) (meta_lit) (old_meta_lit)] * . (sym_lit) @_def_symbol . [(comment) (meta_lit) (old_meta_lit)] * . (sym_lit) . [(comment) (meta_lit) (old_meta_lit)] * . (str_lit (str_content) @capture) @_ignore) (#match \"^\\\\(?:def\\\\(?:inline\\\\|m\\\\(?:acro\\\\|ulti\\\\)\\\\|n-?\\\\|protocol\\\\)\\\\|ns\\\\)$\" @_def_symbol)) ((list_lit . [(comment) (meta_lit) (old_meta_lit)] * . (sym_lit) @_def_symbol (list_lit . (sym_lit) (vec_lit) * (str_lit (str_content) @capture) @_ignore) *) (#match \"^\\\\(?:def\\\\(?:interface\\\\|protocol\\\\)\\\\)$\" @_def_symbol))" "Debug the query with `treesit-query-validate'")
In my init.el, I enable clojure-ts-mode like this: (use-package clojure-ts-mode).
Finally, here’s the relevant parts of my /etc/nixos/configuration.nix:
{ config, lib, pkgs, ... }:
let
myEmacs = (pkgs.emacsPackagesFor pkgs.emacs-pgtk).emacsWithPackages
(epkgs: with epkgs; [
cider
clojure-ts-mode
nix-ts-mode
nov # epub reader
rust-mode
rustic
tree-sitter-langs
treesit-grammars.with-all-grammars
]);
in
{
users.users.philip = { packages = with pkgs; [ myEmacs ]; };
}
Other modes, such as TypeScript, Nix, YAML, are working fine.
Also, when I open a TypeScript file, Emacs loads typescript-ts-mode without printing stuff like “Installing clojure Tree-sitter grammar” in *Messages*. So I wonder why it’s printing that for Clojure.
When I remove clojure-ts-mode from my /etc/nixos/configuration.nix, then Emacs prints
■ Error (use-package): Cannot load clojure-ts-mode
on startup. As expected, I suppose. So TypeScript support must be coming through tree-sitter-langs and/or treesit-grammars.with-all-grammars, whereas Clojure support isn’t.
Any advice for how to get Clojure TS mode working?