C++ Template#
Meson-based C++ starter with a Nix Flake dev shell that ships Clang, tooling, and a simple just workflow so you don't have to worry about Clangd hating the world.
Getting Started#
- Create a project from the template:
nix flake init --template git@tangled.sh:bpavuk.neocities.org/cxx-template - Enter the development shell (installs compilers, linters, debuggers):
nix develop - Configure and build:
just sync # runs meson setup --reconfigure build/ just build # runs meson compile -C build/ ./build/cxx-template # or even simpler just # runs both sync and build. ./build/cxx-template
You can also use direnv to get into the environment upon opening the directory:
direnv allow
To explore more just recipes, run just -l.
Project Layout#
meson.build,src/- Meson project configuration and sources.Justfile- Convenience tasks (sync,build,clean).flake.nix- Dev-shell definition; tweak packages if you need extra tools.
Notes#
- The template intentionally omits tests so you can plug in your preferred framework; add a Meson
test()target when ready. - If you prefer GCC, remove the
stdenv = pkgs.clangStdenvoverride insideflake.nix, and tune theCCandCXXvariables.