Skip to content

Clang ​

Catalog v8.

Installs Clang with clangd, clang-format, clang-tidy and LLDB next to GCC.

Select ​

toml
[toolchains]
clang = "22"

Choose the line in the [toolchains] table of limanix.toml and apply the change. The module brings GCC with its build tools and native library support; cc and c++ stay GCC. Choose the GCC line with gcc in the same table.

Versions ​

ValueClangNotes
2222.xRecommended
2121.xEnd of life
2020.xEnd of life

Lines come from the base Nixpkgs revision. The LLVM project maintains only its newest release; selecting an older line prints a warning when the VM is built.

Use ​

Inside the VM:

console
clang++ -std=c++23 -o app main.cpp
CC=clang CXX=clang++ cmake -B build -G Ninja
clang-format -i main.cpp

On Linux, Clang uses the C++ standard library and the startup files of GCC. It finds the headers and libraries of [nixos] packages the same way as GCC.

Editor support ​

The clangd of the selected line replaces the one that comes with GCC. It runs clang-tidy checks when the project has a .clang-tidy file.

Configuration and integration
BoundaryContract
Public capabilitylmx.capabilities.languageSupport.tools.clangd from the selected line, preferred over the GCC one
IntegrationImports GCC; cc and c++ remain GCC
Compilersclang and clang++ search /run/current-system/sw like GCC
ServicesNo daemon

Free and open source under the Apache License 2.0.