Kernels documentation
Architecture overview
Get started
Use kernels
QuickstartUse layersLock kernel versionsEnvironment variablesProjects using kernelsMigrate from older versionsFAQ
Python API
kernels CLI
Build kernels
Write kernelsBuild with NixDevelop locallySet up your IDESet up for Metal kernelsDevelop kernels with agentsSecure your kernelsGitHub Actions & HF Jobs
kernel-builder CLI
Kernel specifications
Concepts & design
Resources
You are viewing main version, which requires installation from source. If you'd like
regular pip install, checkout the latest stable version (v0.16.0).
Architecture overview
The Kernel Builder is a Nix flake that combines two components:

kernel-builder/: a Rust-based CLI that parses and validatesbuild.toml, scaffolds new kernel projects, and drives the build. It does not compile kernels itself: every build subcommand executesnix build/nix run/nix developagainst the kernel project’sflake.nix.nix-builder: the Nix builder drives the build itself. It generates a build matrix using the supported build configurations (seenix-builder/versions.nix) and the kernel’sbuild.toml. The build matrix is the cartesian product of the backend (one or more of CPU/CUDA/Metal/ROCm/XPU), backend versions, and framework versions. Nix builder useskernel-builderto generate the CMake files that drive the build. To do so,kernel-builderitself is packaged innix-builder/pkgs.
A kernel author uses the Nix builder through the lib.genKernelFlakeOutputs that is exposed through the top-level flake.nix. This generates the Nix flake outputs for building and developing kernels, such as bundle for bundle builds and devShells for development shells.
For a deeper look at the design of the Nix builder, see Nix Builder design.
Update on GitHub