Keyboard shortcuts

Press or to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

Toolchains

A common way to support C and C++ packages in Nix is to integrate their build system and expose a specialized stdenv derivation responsible to bring in all of the necessary tools required to consistently generate, configure, build and link those, and related, packages. The stdenv derivation is a special derivation, defined in Nixpkgs, and can be regarded as a kind of a pattern as well — see its reference: The Standard Environment, on the Nixpkgs Reference Manual. For an introduction to the stdenv as a pattern, see 19. Fundamentals of Stdenv, from the Nix Pills series.

conan-flake is parameterized by a stdenv option (defaulting to pkgs.stdenv), driving this complexity away from this module, which can then be regarded as its interface with the compile infrastructure of the Nix system. It’s used to extract mainly compiler related information and, together with the other options, compute the final configuration, which is exposed as a devShell output.

The two scenarios this project demonstrates are:

  • LLVM — a stdenv in which all dependencies come from the LLVM project, and the compiler.libcxx setting that goes with it.
  • CUDA — the NVIDIA toolchain, linking against the CUDA libraries available in pkgs.cudaPackages.