C++ personal starter project using nix + meson.
git clone https://github.com/shuretokki/cpp-template project
cd project
# if you have direnv:
direnv allow
# else, you could just:
nix developConfiguring the build directory:
meson setup buildYou only run this once. Or again if you change meson.build or add new dependencies.
# compile
meson compile -C build
# run
./build/projectRefer to the Meson Quick Start for detailed guide.
- Add the library to
buildInputsinflake.nix: Refer to the Nix.dev Flakes Concept Manual for how dependencies map to reproducible outputs.
buildInputs = [ pkgs.spdlog pkgs.new-lib ];- Add it to your
meson.build: Refer to the Meson Dependency Documentation for detailed syntax and options.
dependencies: [
dependency('spdlog'),
dependency('new-lib'),
],- Reload and reconfigure:
direnv reload # or exit and re-enter nix develop
meson setup build --wipe