Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
74 commits
Select commit Hold shift + click to select a range
c3ca945
Add conan-flake module
tarc May 6, 2026
0c7b955
Auto generate docs/src/reference/options.md
github-actions[bot] May 6, 2026
d3ac3c2
Add Conan entry to .nav.yml
tarc May 6, 2026
c8c119b
Improve docs
tarc May 6, 2026
9cc9f79
Merge branch 'cachix:main' into feature/conan-flake
tarc May 6, 2026
616a6a9
Merge branch 'cachix:main' into feature/conan-flake
tarc May 7, 2026
2d90ac4
Merge branch 'cachix:main' into feature/conan-flake
tarc May 8, 2026
4f8b0c4
Merge branch 'cachix:main' into feature/conan-flake
tarc May 9, 2026
452ec3f
Improve README.md
tarc May 9, 2026
ed0323e
Merge branch 'cachix:main' into feature/conan-flake
tarc May 11, 2026
4fee351
Merge branch 'cachix:main' into feature/conan-flake
tarc May 12, 2026
d45dea5
Merge branch 'cachix:main' into feature/conan-flake
tarc May 15, 2026
62e6db6
Auto generate docs/src/reference/options.md
github-actions[bot] May 15, 2026
c9ccee0
Improve nonsense comment
tarc May 15, 2026
2e4cfe5
Merge branch 'cachix:main' into feature/conan-flake
tarc May 17, 2026
327cdeb
Merge branch 'cachix:main' into feature/conan-flake
tarc May 18, 2026
171a53a
Merge branch 'cachix:main' into feature/conan-flake
tarc May 19, 2026
01a6c0b
Merge branch 'cachix:main' into feature/conan-flake
tarc May 20, 2026
048d3b6
Merge branch 'cachix:main' into feature/conan-flake
tarc May 21, 2026
eb80d3e
Add cplusplus test
tarc May 21, 2026
80c1f01
Parameterize language.cplusplus
tarc May 21, 2026
07067b1
Add conan package option to lanaguages.cplusplus
tarc May 21, 2026
7f47811
Merge branch 'cachix:main' into feature/conan-flake
tarc May 21, 2026
3cd356e
Auto generate docs/src/reference/options.md
github-actions[bot] May 21, 2026
00b3fe7
Auto generate missing individual markdowns
github-actions[bot] May 21, 2026
ae07f09
Add lanaguages.cplusplus.conan docs
tarc May 21, 2026
48bfd67
Merge branch 'cachix:main' into feature/conan-flake
tarc May 21, 2026
e52ebbd
Auto generate docs/src/reference/options.md
github-actions[bot] May 21, 2026
16192e9
Auto generate missing individual markdowns
github-actions[bot] May 21, 2026
c349360
Fix references
tarc May 22, 2026
b571642
Auto generate missing individual markdowns
github-actions[bot] May 22, 2026
06b6c19
Fix references again...
tarc May 22, 2026
727e096
Auto generate missing individual markdowns
github-actions[bot] May 22, 2026
9fbfcb7
Improve docs and tests
tarc May 22, 2026
2b36151
Auto generate missing individual markdowns
github-actions[bot] May 22, 2026
12aadd4
Improve docs and tests
tarc May 22, 2026
32ca00a
Auto generate missing individual markdowns
github-actions[bot] May 22, 2026
a6dbeb0
Improve tests
tarc May 22, 2026
b10a545
Test clang is default cplusplus compiler by default
tarc May 22, 2026
61f94d4
Fix zig docs (enumeration was broken)
tarc May 22, 2026
255ac6e
Auto generate missing individual markdowns
github-actions[bot] May 22, 2026
b71825f
Merge branch 'cachix:main' into feature/conan-flake
tarc May 22, 2026
5f50dfd
Merge branch 'cachix:main' into feature/conan-flake
tarc May 23, 2026
15a0d75
Merge branch 'cachix:main' into feature/conan-flake
tarc May 25, 2026
9a7ee35
Merge branch 'cachix:main' into feature/conan-flake
tarc May 25, 2026
5917b75
Merge branch 'cachix:main' into feature/conan-flake
tarc May 27, 2026
94e8bb8
Add support to stdenvNoCC
tarc May 27, 2026
aba9410
Merge branch 'cachix:main' into feature/conan-flake
tarc May 28, 2026
791d008
Test the commands are in path (do not call getExe directly on packages)
tarc May 29, 2026
ae3611f
Merge branch 'cachix:main' into feature/conan-flake
tarc May 29, 2026
977f34d
Merge branch 'cachix:main' into feature/conan-flake
tarc May 29, 2026
be32dc8
Improve docs and test local-recipe-index
tarc Jun 1, 2026
4eaf491
Auto generate missing individual markdowns
github-actions[bot] Jun 1, 2026
e998337
Fix docs: compiler.cppstd=14
tarc Jun 1, 2026
dd82f83
Auto generate missing individual markdowns
github-actions[bot] Jun 1, 2026
90dc2c3
Revert "Fix zig docs (enumeration was broken)"
tarc Jun 1, 2026
a95d5fb
Auto generate missing individual markdowns
github-actions[bot] Jun 1, 2026
a199d0b
Merge branch 'cachix:main' into feature/conan-flake
tarc Jun 1, 2026
9d5c727
Merge branch 'cachix:main' into feature/conan-flake
tarc Jun 4, 2026
2076256
Merge branch 'cachix:main' into feature/conan-flake
tarc Jun 4, 2026
0ca13ad
Merge branch 'cachix:main' into feature/conan-flake
tarc Jun 5, 2026
7504ac0
Fix cpluplux doc
tarc Jun 5, 2026
0202f11
Auto generate missing individual markdowns
github-actions[bot] Jun 5, 2026
236c53a
Merge branch 'cachix:main' into feature/conan-flake
tarc Jun 5, 2026
153374c
Prefer devenv.root over git.root for configRoot
tarc Jun 5, 2026
0e3e703
Merge branch 'cachix:main' into feature/conan-flake
tarc Jun 8, 2026
2ba399c
Merge branch 'cachix:main' into feature/conan-flake
tarc Jun 10, 2026
5ed84a2
Set profiles.platformToolRequires instead of platformToolRequires
tarc Jun 10, 2026
d8e1c06
Update docs to use profiles.platformToolRequires
tarc Jun 10, 2026
1b5e3fa
Auto generate missing individual markdowns
github-actions[bot] Jun 10, 2026
d9613fa
Merge branch 'cachix:main' into feature/conan-flake
tarc Jun 10, 2026
e5b3e8f
Tweak docs
tarc Jun 10, 2026
2c6b10c
Auto generate missing individual markdowns
github-actions[bot] Jun 10, 2026
951a7f0
Merge branch 'cachix:main' into feature/conan-flake
tarc Jun 12, 2026
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
217 changes: 217 additions & 0 deletions docs/src/individual-docs/languages/cplusplus.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,221 @@
## Getting Started

The easiest way to get started with C++ is to simply enable it:

```nix
languages.cplusplus = {
enable = true;
};
```

This will automatically:

- Use `clang` as the default C++ package
- Install it along with CMake and other tools

Alternatively, you can manually specify packages:

```nix
languages.cplusplus = {
enable = true;
package = pkgs.stdenv.cc;
};
```

## Setting up the [Conan](https://conan.io/) package manager

Add conan-flake to your inputs:

```shell-session
$ devenv inputs add conan-flake git+https://codeberg.org/tarcisio/conan-flake
```

The conan-flake module bridges the gap between Nix and Conan, supporting a declarative configuration style. For instance, for a user profile configuration like the following:

```ini
[settings]
build_type=Debug
compiler.cppstd=14

[platform_tool_requires]
cmake/X.Y.Z
```

There correspond the following conan-flake options:

```nix
{
buildType = "Debug";
compilerCppStd = "14";

profiles.platformToolRequires = {
cmake = pkgs.cmake.version;
};

devShell = {
# Programs you want to make available in the shell:
tools = {
inherit (pkgs) cmake;
};
};
}
```

You can check [the list of available options](/reference/options.md#languagescplusplusconanenable). The [`languages.cplusplus.conan.config`](/reference/options.md#languagescplusplusconanconfig) option, however, maps the whole of the options available in the [conan-flake](https://flake.parts/options/conan-flake.html) module — check the [official module documentation](https://flake.parts/options/conan-flake.html#options) and see the examples in [conan-flake's README file](https://codeberg.org/tarcisio/conan-flake/src/branch/main/README.md) to help you setting up.

Config the `devenv.nix` file accordingly. For example:

```nix
languages.cplusplus = {
enable = true;
conan = {
enable = true;
install.enable = true;
config = {
buildType = "Debug";
compilerCppStd = "14";
};
};
};
```

By default, when Conan is enabled:

- The default C++ package is set to `config.stdenv.cc`
- Conan is configured to use the same CMake available in the developmemnt shell; it's not necessary to set the `languages.cplusplus.conan.config.profiles.platformToolRequires.cmake` and `languages.cplusplus.conan.config.devShell.tools` options explicitly

### In Action:

```shell-session
$ devenv shell
Building shell ...
Entering shell ...

conan profile show # This would show the configured profile.
```

## Additional Examples

### LLVM-based C++ Toolchain

If you would like to integrate with the LLVM compiler infrastructure:

```nix
{ pkgs, ... }:

{
languages.cplusplus = {
enable = true;
conan = {
enable = true;
install.enable = true;
config = {
stdenv = pkgs.overrideCC
(
pkgs.llvmPackages.libcxxStdenv.override {
targetPlatform.useLLVM = true;
}
)
pkgs.llvmPackages.clangUseLLVM;
# By default: compiler.libcxx=libstdc++11, so undo it:
compilerLibCxx = null;
};
};
};
}
```

Or even:

```nix
{ pkgs, ... }:

{
stdenv = pkgs.overrideCC
(
pkgs.llvmPackages.libcxxStdenv.override {
targetPlatform.useLLVM = true;
}
)
pkgs.llvmPackages.clangUseLLVM;

languages.cplusplus = {
enable = true;
conan = {
enable = true;
install.enable = true;
config = {
# By default: compiler.libcxx=libstdc++11, so undo it:
compilerLibCxx = null;
};
};
};
}
```

In this second use case:

- By default, conan-flake is configured using the same stdenv as devenv's (that is, `config.stdenv`)

### In Action:

```shell-session
$ devenv shell
Building shell ...
Entering shell ...

conan profile show # This would show the configured profile.
conan create . --build=missing # This would create and test the current package.
```

### A local-recipe-index remote

With [local-recipe-index](https://docs.conan.io/2/tutorial/conan_repositories/setup_local_recipes_index.html) remotes it's possible to declare dependencies from a simplified local index structure:

```nix
{
languages.cplusplus = {
enable = true;

conan = {
enable = true;
install.enable = true;

config = {
buildType = "Release";
compilerCppStd = "17";

remotes.local = {
url = "./repo";
local = true;
allowedPackages = [
"hello-world/0.0.1.cci.20260428"
];
};

offline = true;
};
};
};
}
```

The options in the `languages.cplusplus.conan.config` namespace:

- `remotes.local.url`: is taken as a relative path to the root of the configuration
- `offline`: enable only local remotes (that is, only of local-recipe-index type)

### In Action:

```shell-session
$ devenv shell
Building shell ...
Entering shell ...

conan profile show # This would show the configured profile.
conan remote list # This would list the configured remotes.
conan create . --build=missing # This would create and test the current package.
```

[comment]: # (Please add your documentation on top of this line)

Expand Down
Loading