Getting started
Every example of this site is a runnable project, collected under examples in the source repository, and each one is also exposed as a flake template. The quickest way from an empty directory to a working Conan configuration is to instantiate one of them:
mkdir -p hello-conan && cd hello-conan
git init
nix flake init -t "git+https://codeberg.org/tarcisio/conan-flake"#templates.devenv-module-recipe
That template is the devenv example featuring a
local-recipe-index remote; it carries a complete C++ project — a
conanfile.py recipe, its sources and a test package — alongside the Conan
configuration itself, which is the devenv.nix shown in the
devenv chapter.
The shell can be activated with direnv:
direnv allow .
It can take a while before completing. After that, the conan command is
available in the path, with the profile and the other Conan settings already in
place, so the Conan package defined by the recipe can be built and tested with a
call to conan create:
conan create . --build=missing
Whose output can be used to validate if the configuration was applied successfully:
hello-world: Hello World Release!
hello-world: __x86_64__ defined
hello-world: _GLIBCXX_USE_CXX11_ABI 1
hello-world: __cplusplus201703
hello-world: __GNUC__15
hello-world: __GNUC_MINOR__2
example/0.0.1 test_package
Warning
Depending when this page is being accessed, the devenv integration may still be pending approval upstream. The devenv samples here can still be tested nonetheless, by overriding devenv itself with the version from our upstream PR. See examples/devenv-module-recipe and devenv.yaml therein for more details. The flake-parts and standalone templates are unaffected.
Working from a clone
It’s also possible to interact directly with the example projects from a clone of this repository:1
git clone ssh://git@codeberg.org/tarcisio/conan-flake.git
cd conan-flake
The example above is on the examples/devenv-module-recipe directory:
cd examples/devenv-module-recipe
direnv allow .
And the same conan create call applies from there.
Where to go next
- The option reference lists
every option of the module, and carries the initial setup instructions for
flake-partsscenarios. - The templates chapter lists the remaining templates, one per integration style.
- The flake-parts, devenv and standalone chapters walk through each of those styles.
-
Or, via https:
↩git clone https://codeberg.org/tarcisio/conan-flake.git cd conan-flake