Skip to content

cuda

Recipe card from the charly-distros plugin (Images — the deployable catalog).

CUDA compiler, cuDNN, ONNX Runtime, and GPU development libraries. This layer is the toolkit, and it deliberately carries no driver dependency: layer-nvidia is the driver, and the driver’s contract is decided by the substrate, not by the toolkit.

  • A pod takes the driver from the host: the kernel module is host-global and the runtime injects the user-space per container through /etc/cdi/nvidia.yaml. A pod image that bakes a driver user-space shadows the host’s (layer-cdi’s cdi-no-baked-driver-binaries fails the build when it does).
  • A VM owns its kernel and must bake the driver itself, so a VM / NVIDIA-substrate box composes layer-nvidia at the box level.

A require: here is target-blind: it pushed the driver into every pod that composed the toolkit, and it then had to be stripped again, leaving layer-nvidia’s baked check: steps asserting /usr/bin/nvidia-ctk on an image whose composition deletes it (opencharly/layer-nvidia#25, opencharly/spec#395). The toolkit is now installed driver-free at the SOURCE (below), so there is no strip step at all.

Property Value
Install files task:, charly.yml
Depends ffmpeg
Variable Value
CUDA_HOME /usr

PAC: python-onnxruntime-cpu in the package arm; cuda and cudnn are installed by the plan step with --assume-installed opencl-nvidia (driver-free — the driver comes from the host through CDI).

Note: FFmpeg codec libraries are provided via the ffmpeg dependency candy rather than installed directly. CUDA packages come from the standard Arch/CachyOS repos; the Fedora arm was retired with the Fedora CDI boxes (opencharly/distro-fedora#137).

The candy is multi-distro. The distro.arch section installs cuda, cudnn, and python-onnxruntime-cpu from the Arch repos. Arch installs CUDA under /opt/cuda — its toolkit headers under /opt/cuda/targets/x86_64-linux/include/ — while CUDA_HOME is /usr, so the Arch path links every entry of those trees into /usr — files of any extension and subtrees alike, enumerated rather than pattern-matched. nvcc computes its include root relative to its own executable, and /usr/bin/nvcc is a symlink, so anything not reachable under /usr/include cannot be found: cuda_runtime.h’s own #include fails and every CUDA build dies at CMake’s enable_language(CUDA) with “No such file or directory”. Matching on patterns produced both of those failures, on both Arch arms, while every probe in this plan still passed (opencharly/layer-cuda#9): first a *.h glob that linked the top-level headers but not the crt/ and cccl/ subtrees, then the same glob missing the .hpp half of the _functions family once the subtrees were linked. The check cuda-arch-header-root preprocesses a real CUDA translation unit to prove the whole header root resolves.

With that stitch in place, the same nvcc, header, and library paths resolve identically on Arch/CachyOS.

Driver user-space vs the CUDA runtime — installed driver-free at the SOURCE

Section titled “Driver user-space vs the CUDA runtime — installed driver-free at the SOURCE”

Installing the toolkit would drag in host-coupled driver user-space: on the pac path cuda depends on opencl-nvidia (three driver files), and cudnn depends on cuda. This layer therefore installs the toolkit with that dependency treated as satisfied:

pacman -Syu --noconfirm --needed --assume-installed opencl-nvidia cuda cudnn

The driver reaches a pod from the host through CDI (podcdi.pod-cdi), its only provider; the image bakes none, and there is no strip step any more (opencharly/layer-cuda#39). layer-cdi asserts the result at build time. Measured in a disposable cachyos container: nvcc and libcudart/libcublas present, zero driver residue, no nvidia-smi/nvidia-ctk.

The runtime/compute libraries must stay: libcudart*, libcudadevrt*, libcublas*, libcudnn*, libnvrtc*, libcurand*, libcufft*, libcusparse*, libcusolver*, libnvJitLink*. The anchored predicate (libcuda.so*, never libcuda*) remains the rule for anyone auditing an image: the prefix family also spans the runtime (opencharly/layer-cuda#23), and libcudadebugger.so* is driver user-space without the libcuda.so stem. The Xorg/NVIDIA-package driver trees are no longer a subject of this layer — nothing installs them.

Installs the toolkit driver-free (see above) and stitches /opt/cuda → /usr on Arch/CachyOS.

A pod: compose the toolkit only. The driver is injected by the host through the CDI spec, so the image names no driver layer at all.

# charly.yml — a pod image (CachyOS only; the Fedora CDI boxes were dropped in
# opencharly/distro-fedora#137 — umbrella opencharly/opencharly#1287).
# `pod-cdi` carries the contract and, today, the toolkit; the class split (a wheel-only
# pod composes no toolkit) is opencharly/layer-cuda#39.
comfyui-cdi:
candy:
base: podcdi.pod-cdi
candy:
- '@github.com/opencharly/pod-comfyui:<tag>'

A VM: the box names layer-nvidia itself, beside the toolkit. The two are siblings at the box level, never a require: inside either layer.

# charly.yml — a passthrough-VM box
gpu-vm:
candy:
base: cachyos.cachyos
candy:
- '@github.com/opencharly/layer-nvidia:v2026.327.0533'
- '@github.com/opencharly/layer-cuda:v2026.326.2259'
  • podcdi.pod-cdi — the GPU pod base every CachyOS GPU box composes (the toolkit today, with the driver left to CDI); the Fedora CDI boxes were dropped (opencharly/opencharly#1287)
  • a GPU-passthrough VM box, which composes layer-nvidia beside this layer
  • cuda-arch-builder — the CUDA-capable NVENC builder (opencharly/distro-arch)
  • versa, immich-cdi — the toolkit on a pod
  • /charly-image:layer — candy authoring reference (charly.yml schema, task verbs, service declarations)
  • /charly-check:check — declarative testing (check: block, charly check box, charly check live)