website/content/en/docs/dev/drivers.md
| ⚡ Requirement | Lima >= 2.0 |
|---|
Lima supports two types of drivers: internal and external. This architecture allows for extensibility and platform-specific implementations. Drivers are unware whether they are internal or external.
💡 See also: VM Types for user configuration of different virtualization backends.
Internal Drivers are compiled directly into the limactl binary and are registered automatically at startup by passing the driver object into registry.Register() function and importing the package in the main limactl code using Go's blank import _. For example:
Build tags control which drivers are compiled as internal vs external (e.g., external_qemu, external_vz, external_wsl2).
External Drivers are separate executables that communicate with Lima via gRPC. They are discovered at runtime from configured directories.
⚠️ Note: External drivers are experimental and the API may change in future releases.
You can build existing internal drivers as external drivers using the ADDITIONAL_DRIVERS Makefile variable:
# Build QEMU as external driver
make ADDITIONAL_DRIVERS=qemu limactl additional-drivers
# Build multiple drivers as external
make ADDITIONAL_DRIVERS="qemu vz wsl2" limactl additional-drivers
This creates external driver binaries in _output/libexec/lima/ with the naming pattern lima-driver-<name> (or lima-driver-<name>.exe on Windows).
Lima discovers external drivers from these locations:
LIMA_DRIVERS_PATH environment variable<LIMA-PREFIX>/libexec/lima/, where <LIMA_PREFIX> is the location path where the Lima binary is presentThe discovery process is handled by pkg/registry/registry.go.
To create a new external driver:
driver.Driver interface:type Driver interface {
Lifecycle
GUI
SnapshotManager
GuestAgent
Info() Info
Configure(inst *limatype.Instance) *ConfiguredDriver
FillConfig(ctx context.Context, cfg *limatype.LimaYAML, filePath string) error
SSHAddress(ctx context.Context) (string, error)
}
server.Serve() to expose your driver:package main
import (
"context"
"github.com/lima-vm/lima/v2/pkg/driver/external/server"
)
func main() {
driver := &MyDriver{}
server.Serve(context.Background(), driver)
}
Build and deploy:
go build -o lima-driver-mydriver main.goLIMA_DRIVERS_PATHUse the driver: Explicitly specify the driver when creating instances:
limactl create myinstance --vm-type=mydriver template:default
See existing external driver implementations: