Using Nix

Topiary provides a flake with several outputs. The main being topiary-cli, which builds a version of the CLI that doesn't come with any Tree-sitter grammars. However, this version cannot be used in Nix. For that purpose the flake also provides the topiary-cli-nix package. This package utilises the Tree-sitter grammars from the nixpkgs flake input.

Note that some Tree-sitter grammars haven't been added to nixpkgs yet, so respective languages are disabled in these cases.

Git hooks

Topiary integrates seamlessly with pre-commit-hooks.nix: add Topiary as input to your flake and, in pre-commit-hooks.nix's setup, use:

pre-commit-check = nix-pre-commit-hooks.run {
  hooks = {
    nixfmt.enable = true; ## keep your normal hooks
    ...
    ## Add the following:
    topiary = topiary.lib.${system}.pre-commit-hook;
  };
};