bootstrap/specs/clang/template
Joshua Potter d1d383a5a7 Fixup pre-commits to use `=~` where not. 2023-12-19 05:48:06 -07:00
..
.githooks Fixup pre-commits to use `=~` where not. 2023-12-19 05:48:06 -07:00
.clang-format Add clang spec. 2023-11-26 14:51:41 -07:00
.envrc Add clang spec. 2023-11-26 14:51:41 -07:00
.gitignore Anchor most .gitignore entries to the project root. 2023-11-28 09:21:11 -07:00
Doxyfile Add clang spec. 2023-11-26 14:51:41 -07:00
README.md Normalize bash prompts and flake descriptions. 2023-12-01 10:12:16 -07:00
default.nix Add clang spec. 2023-11-26 14:51:41 -07:00
flake.lock Add clang spec. 2023-11-26 14:51:41 -07:00
flake.nix Normalize bash prompts and flake descriptions. 2023-12-01 10:12:16 -07:00
main.c Add clang spec. 2023-11-26 14:51:41 -07:00

README.md

Clang Flake Template

This is a template for constructing a working environment for C development with the clang (version 16.0.6) toolchain. direnv can be used to launch a dev shell upon entering this directory (refer to .envrc). Otherwise run via:

$ nix develop

Language Server

The clangd LSP (version 14.0.6) is included in this flake. The codelldb VSCode plugin is also included to interface with the LSP. Note this plugin, despite its name, is compatible with other editors (e.g. neovim). To configure, refer to your editor's documentation. To use the LSP across files, a compilation database must be generated. For this reason, bear (version 3.1.3) is included in this flake. Use as follows to generate a compile_commands.json file:

$ bear -- <your-build-command>

Documentation

Documentation is generated using Doxygen (version 1.9.7). (Re)generate documentation by editing the Doxyfile and running:

$ doxygen

Formatting

Formatting depends on the clang-format (version 14.0.6) tool. Refer to .clang-format for default formatting options. A pre-commit hook is included in .githooks that can be used to format all *.c and *.h files prior to commit. Install via:

$ git config --local core.hooksPath .githooks/

If running direnv, this hook is installed automatically when entering the directory.