Skip to content

conan-flake

The conan-flake module bridges the gap between Nix and the Conan C/C++ Package Manager, supporting a declarative configuration style and common development workflows.

For a user profile configuration like the following:

[settings]
build_type=Debug
compiler.cppstd=14
[platform_tool_requires]
cmake/X.Y.Z

There correspond the following options:

{
profiles.default = {
settings.build_type = "Debug";
settings."compiler.cppstd" = "14";
platformToolRequires = {
cmake = pkgs.cmake.version;
};
};
devShell = {
# Programs you want to make available in the shell:
tools = { inherit (pkgs) cmake; };
};
}

The conan-flake module works with plain Nix (no flakes), Nix flakes, flake-parts, or as a devenv module.

  • Getting started takes an empty directory to a working Conan configuration, using one of the templates.
  • flake-parts covers the flake-parts integration.
  • devenv covers the devenv integration, both through devenv’s own languages.cplusplus.conan option and with conan-flake used directly as a devenv module.
  • Standalone covers plain Nix usage, with and without flakes.
  • Toolchains covers the LLVM/libc++ and CUDA scenarios.
  • The option reference lists every option of the module, generated from the module itself, along with initial setup instructions for flake-parts scenarios.

The source lives at codeberg.org/tarcisio/conan-flake, where issues and pull requests are welcome; see Contributing for the development environment, and the Changelog for the revision history.