A starting point for command-line applications and reusable C++ libraries, built with Meson and reproducible Nix environments.
Native tests, static analysis, sanitizers, and packaging — with cross-compilation for Linux ARM64, Windows, and WebAssembly.
- Run NixonCpp in your browser — WebAssembly debug build; C++ sources are available in DevTools under
debug-src/src. - Browse the API documentation — Doxygen reference for the C++ application and library.
On NixOS with flakes enabled, you can build and run the sample application directly from GitHub:
nix run 'github:tomasmark79/NixonCpp?dir=nix'NixonCpp also works well in GitHub Codespaces, using the included devcontainer configuration for development in your browser.
For a first native build on Linux, have Git and Nix with flakes enabled installed. The Nix shell supplies the compiler, build tools, and project dependencies. Its first launch may take a while as packages are downloaded.
git clone https://github.com/tomasmark79/NixonCpp.git
cd NixonCpp
nix develop ./nix
# Build and run the native debug application
make debug
./build/builddir-debug/NixonCpp
# Run the test suite
make testRun the build, application, and tests from the repository root inside the Nix shell. The sample application prints its detected platform, initializes the library, reports Successfully loaded asset: NixonCppLogo.svg, and exits. The test command should finish with no failures.
Start with src/app/Application.cpp, which contains main(), command-line options, and the sample application flow. Change its behavior, then repeat the build and run commands above.
| Location | Purpose |
|---|---|
| src/app/ | Application entry point and behavior |
| src/lib/ | Library implementation and shared utilities |
| include/ | Public library headers |
| assets/ | Runtime assets and the WebAssembly HTML shell |
| tests/ | Unit tests and their Meson configuration |
| meson.build | Build targets, source lists, dependencies, and compiler options |
| nix/ | Reproducible development environments and cross-compilation toolchains |
For reusable functionality, edit src/lib/NixonCppLib.cpp and its public interface in include/NixonCppLib/NixonCppLib.hpp. Add tests under tests/ and register new source files in the appropriate meson.build file.
Follow Creating your own project to rename the template, update project metadata and attribution, and configure CI and publishing for your repository.
- C++20 by default
- Application, shared library, and static library targets
- Nix development environments and reproducible package builds
- GoogleTest, clang-format, clang-tidy, AddressSanitizer, and UBSan
- Cross-builds for aarch64-linux, Windows, and WebAssembly
- Doxygen documentation published through GitHub Pages
- Project renaming, packaging, VS Code, devcontainer, and Codespaces support
- Build targets and packaging — native Linux, Linux ARM64, Windows, and WebAssembly builds, build types, and deployable packages.
- Debugging — native debugging with GDB and browser debugging with C++ source maps.
- Development tools — tests, formatting, static analysis, sanitizers, and editor integration.
The older I get, the more I look for real simplicity in what I do. I built this template for myself out of a desire for one comprehensive, reusable development environment for software that can serve different purposes and run across platforms. A consistent foundation lets me spend less time putting the tools together and more time building the software itself. 🙂
On my NixOS system, a single command — make package-all — now builds the application for native Linux, Linux ARM64, Windows, and WebAssembly, and packages the results into separate deployment archives.
If NixonCpp helps with your projects, you can support its development:
This template was designed and developed through human effort. AI was used as an assistant during later stages of development; it was not used to randomly assemble the project. The architecture, implementation decisions, and responsibility for the result remain with the author.