devenv
There are two ways of using conan-flake with devenv: the
languages.cplusplus.conan option, which devenv itself provides and which
carries conan-flake’s own options under languages.cplusplus.conan.config, and
a devenv shell that takes conan-flake’s computed devShell directly.
The languages.cplusplus.conan option
Section titled “The languages.cplusplus.conan option”Configure Conan in any devenv shell with the supported integration:
languages.cplusplus = { enable = true;
conan = { enable = true; install.enable = true;
config = { profiles.default = { settings.build_type = "Release"; settings."compiler.cppstd" = "17"; };
# It's possible to specify Conan remotes explicitly, including # local-recipe-index remotes, in which case the `url` is taken as a # relative path to the root of the configuration: remotes.local = { url = "./repo"; local = true; allowedPackages = [ "hello-world/0.0.1.cci.20260428" ]; };
# Enable only local remotes (i.e., only of local-recipe-index type): offline = true; }; };}; # languages.cplusplusThe example above is on the examples/devenv-module-recipe directory, and the Getting started chapter walks through it. A variant without the local-recipe-index remote is on examples/devenv-module; its profile settings, and the Conan profile they produce, are the pair shown on the front page.
A devenv shell taking conan-flake’s devShell
Section titled “A devenv shell taking conan-flake’s devShell”Where devenv shells are declared through
flake-parts, conan-flake can be used without the
languages.cplusplus option at all: importing inputs.conan-flake.flakeModule
next to inputs.devenv.flakeModule makes config.conan.outputs.devShell
available, which composes into a devenv shell the same way it composes into a
pkgs.mkShell:
devenv = { shells.default = { name = "conan-flake-dev";
inputsFrom = [ # conan-flake exposes a `configuration` devShell by default that # can be used directly, or passed in the inputsFrom option as a # means to compose with other devShell modules. config.conan.outputs.devShell ];
packages = [ pkgs.just ];
treefmt = { enable = true; config = { programs = { nixpkgs-fmt.enable = true; cmake-format.enable = true; }; }; }; };}; # devenvThat example is on the
examples/devenv
directory, whose Conan configuration is written with the same
perSystem.conan
options the flake-parts chapter describes:
cd examples/devenvdirenv allow .Either way, the options being set are conan-flake’s own, and the complete list
of them is in the
option reference — under
perSystem.conan for the flake-parts spelling, and under
languages.cplusplus.conan.config for the devenv one.