Versions in this module Expand all Collapse all v0 v0.26.0 Nov 14, 2026 v0.25.0 Nov 12, 2026 v0.24.0 Nov 12, 2026 Changes in this version type TemplateData + PreStartRefusedExitCode int v0.23.0 Nov 9, 2026 Changes in this version + const MachinesDir + var ErrNotWired = errors.New("nspawn backend operation not configured") + var Templates = template.Must(...) + func ConfirmNotEnabled(ctx context.Context, log *slog.Logger, service string) error + func Enable(ctx context.Context, r Runner, name string) error + func Exec(ctx context.Context, log *slog.Logger, slot string, args ...string) (string, error) + func FirstRegistered(ctx context.Context, log *slog.Logger, slots ...string) (string, error) + func IsAlreadyExists(err error) bool + func Logs(ctx context.Context, slot string, opts isolation.LogOptions) (io.ReadCloser, error) + func MissingTool(err error) bool + func MountDeviceAllowEntries(mounts []config.AdditionalHostMount) []string + func Registered(ctx context.Context, log *slog.Logger, name string) (bool, error) + func RegisteredForCleanup(ctx context.Context, log *slog.Logger, name string) (bool, error) + func Remove(ctx context.Context, log *slog.Logger, name string) error + func RemoveBPFFSMount(ctx context.Context, log *slog.Logger, mountPath string) error + func RemoveConfig(log *slog.Logger, p ConfigPaths) error + func Root(slot string) isolation.DirRoot + func RootAt(slot, dir string) isolation.DirRoot + func ServiceName(machine string) string + func StartWithRecovery(ctx context.Context, log *slog.Logger, r Runner, name string) (wasRunning bool, err error) + func Stop(ctx context.Context, log *slog.Logger, name string) error + func WaitForMachine(ctx context.Context, log *slog.Logger, machine string) error + type Backend struct + Log *slog.Logger + Ops Ops + func (*Backend) Logs(ctx context.Context, r isolation.SlotRef, opts isolation.LogOptions) (io.ReadCloser, error) + func (*Backend) Mode() isolation.Mode + func (*Backend) Requirements() isolation.Requirements + func (b *Backend) Destroy(ctx context.Context, r isolation.SlotRef) error + func (b *Backend) Exec(ctx context.Context, r isolation.SlotRef, cmd isolation.ExecSpec) (isolation.ExecResult, error) + func (b *Backend) Prepare(ctx context.Context, n isolation.NodeSpec) (isolation.NodeRoot, error) + func (b *Backend) Restart(ctx context.Context, r isolation.SlotRef) error + func (b *Backend) Start(ctx context.Context, r isolation.SlotRef) error + func (b *Backend) Status(ctx context.Context, r isolation.SlotRef) (isolation.Status, error) + func (b *Backend) Stop(ctx context.Context, r isolation.SlotRef) error + type Bind struct + ReadOnly bool + Source string + Target string + type ConfigPaths struct + BPFFSMountPath string + ConfigRegenerationUnit string + NSpawnFile string + OverrideDir string + type DeviceAllow struct + Access string + Specifier string + type DeviceTarget struct + Allow DeviceAllow + Bind Bind + func NvidiaDeviceTargets(paths []string) []DeviceTarget + type Ops struct + Destroy func(ctx context.Context, r isolation.SlotRef) error + Prepare func(ctx context.Context, n isolation.NodeSpec) (isolation.NodeRoot, error) + Restart func(ctx context.Context, r isolation.SlotRef) error + Start func(ctx context.Context, r isolation.SlotRef) error + Stop func(ctx context.Context, r isolation.SlotRef) error + type Rendered struct + ConfigRegenerationUnit []byte + ServiceOverride []byte + Settings []byte + func Render(data TemplateData) (Rendered, error) + type Runner interface + Enable func(ctx context.Context, name string) error + Exists func(ctx context.Context, name string) bool + ResetFailed func(ctx context.Context, name string) error + Running func(ctx context.Context, name string) (bool, error) + Start func(ctx context.Context, name string) error + Terminate func(ctx context.Context, name string) error + func NewRunner(log *slog.Logger) Runner + type TemplateData struct + AMDGPUDevicePaths []string + AMDSysFSPaths []string + AdditionalHostMounts []config.AdditionalHostMount + BPFFSMountPath string + ConfigRegenerationUnit string + ContainerImageArchiveDir string + ContainerImageArchiveHostDir string + HostDeviceGroupSpecifiers []string + HostDevicePaths []string + MachineName string + MountDeviceAllow []string + NvidiaBinDir string + NvidiaDeviceTargets []DeviceTarget + NvidiaI386LibDirMounts []isolation.LibDirMount + NvidiaLibDirMounts []isolation.LibDirMount + PostStartCommand string + PreStartCommand string + func (d *TemplateData) ApplyGrants(grants []isolation.Grant)