Skip to content

Repository files navigation

conan-flake

Nix module for Conan configuration

status-badgestatus-badge

Documentation · Option reference · Changelog

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. Conan profiles, remotes and tool requirements are declared as Nix options, and the Conan configuration files, the wrapper commands and the development shell are generated from them.

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

A configuration declaring a Debug profile, the C++ standard to compile against, and a cmake taken from Nix instead of built by Conan looks like this:

{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;};};}

From it, conan-flake renders the matching Conan profile — its [settings] and [platform_tool_requires] sections — and puts cmake on the PATH of the development shell, so that Conan resolves the tool from the environment instead of building it. The entry page of the documentation site shows the rendered profile next to these options.

Getting started

Instantiate one of the templates into an empty directory:

nix flake init -t "git+https://codeberg.org/tarcisio/conan-flake"#templates.devenv-module-recipe

The getting started chapter takes that directory to a Conan package built with the generated configuration, and the other chapters cover the remaining ways of consuming the module.

Documentation

The documentation site is at https://tarcisio.codeberg.page/conan-flake/:

  • Getting started — from an empty directory to a working Conan configuration, and the example projects this repository ships.
  • flake-parts — the flake-parts integration: the flake inputs, the perSystem.conan options, and composing the generated development shell.
  • devenv — the devenv integration, through devenv's own languages.cplusplus.conan option and with conan-flake used directly as a devenv module.
  • Standalone — plain Nix usage, with and without flakes.
  • Toolchains — configuring the compiler and the standard library conan-flake reports to Conan.
    • LLVM — clang with libc++.
    • CUDA — the CUDA toolkit and its host compiler.
  • Templates — every template of this flake and the command that instantiates it.
  • Contributing — the development environment, the checks, and the generated blocks.
  • References — the projects, tutorials and manuals this one builds on.
  • Changelog — the revision history.

The option reference lists every option of the module, generated from the module itself, along with initial setup instructions for flake-parts scenarios.

Issues and pull requests are welcome at codeberg.org/tarcisio/conan-flake.

License

conan-flake is distributed under the terms of the MIT license — see LICENSE.

About

Declarative Configuration for Conan package manager — read-only mirror of codeberg.org/tarcisio/conan-flake

Topics

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages