Skip to content

virt.lima #

tips

openrc as used on alpine

fn new #

fn new() !LimaFactory

enum PlatformType #

enum PlatformType {
	aarch64
	x86_64
}

enum TemplateName #

enum TemplateName {
	ubuntu
	ubuntucloud
	alpine
	arch
	containerd
}

enum VMStatus #

enum VMStatus {
	unknown
	running
	stopped
}

struct ActionArgs #

@[params]
struct ActionArgs {
pub:
	force bool
}

struct LimaFactory #

@[heap]
struct LimaFactory {
pub mut:
	debug bool
}

fn (LimaFactory) vm_delete #

fn (mut lf LimaFactory) vm_delete(name string) !

fn (LimaFactory) vm_delete_all #

fn (mut lf LimaFactory) vm_delete_all() !

fn (LimaFactory) vm_exists #

fn (mut lf LimaFactory) vm_exists(name string) !bool

fn (LimaFactory) vm_get #

fn (mut lf LimaFactory) vm_get(name string) !VM

fn (LimaFactory) vm_get_all #

fn (mut lf LimaFactory) vm_get_all() ![]VM

fn (LimaFactory) vm_list #

fn (mut lf LimaFactory) vm_list() ![]string

fn (LimaFactory) vm_new #

fn (mut lf LimaFactory) vm_new(args VMNewArgs) !VM

valid template names: .alpine,.arch .

fn (LimaFactory) vm_stop #

fn (mut lf LimaFactory) vm_stop(name string) !

fn (LimaFactory) vm_stop_all #

fn (mut lf LimaFactory) vm_stop_all() !

struct VM #

@[heap]
struct VM {
pub mut:
	name           string
	status         VMStatus
	dir            string
	arch           string
	cpus           int
	memory         i64
	disk           i64
	ssh_local_port int
	// host_agent_pid  int [json: hostAgentPID]
	// driver_pid     int [json: driverPID]
	ssh_address string
	// lima_home      string [json: LimaHome]
	identity_file string       @[json: IdentityFile]
	factory       &LimaFactory @[skip; str: skip]
}

fn (VM) load #

fn (mut vm VM) load(args ActionArgs) !

fn (VM) stop #

fn (mut vm VM) stop(args ActionArgs) !

fn (VM) start #

fn (mut vm VM) start(args ActionArgs) !

fn (VM) delete #

fn (mut vm VM) delete(args ActionArgs) !

fn (VM) install_crystal #

fn (mut vm VM) install_crystal() !

struct VMNewArgs #

@[params]
struct VMNewArgs {
pub mut:
	name            string = 'default'
	template        TemplateName
	platform        PlatformType
	cpus            int = 8
	memory          i64 = 2000  // in MB
	disk            i64 = 50000 // in MB
	reset           bool
	start           bool = true
	install_crystal bool // if you want crystal to be installed
	install_hero    bool
}