Help us shape the future of Go! Take the 2026 Go Developer Survey

templates

package
v0.3.2 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Oct 19, 2026 License: MIT Imports: 12 Imported by: 0

Documentation

Overview

Package templates gives limactl a directory of templates to read.

The templates are embedded in the binary. Lima needs real files, and it resolves `base:` and `file:` references relative to each template, so the whole tree is written once to ~/.cache/limabean/templates/<hash>/, named after a hash of its contents: a binary with different templates gets a fresh copy, and an unchanged one reuses it.

Index

Constants

View Source
const CorePack = "core"

CorePack is installed in every VM, by layer-base.yaml itself.

Variables

This section is empty.

Functions

func Envs

func Envs(root string) ([]string, error)

Envs lists the environments in a templates root: built-in ones by name, and your own as written in your templates directory.

func Path

func Path(root, env string) (string, error)

Path returns the template file for an environment. Your own environment replaces a built-in one with the same name.

func ResolvePacks added in v0.1.4

func ResolvePacks(all []Pack, defaults, with, without []string) ([]string, error)

ResolvePacks turns a default set and additions and removals into the sorted packs a VM gets (core isn't listed: every VM has it). Unknown names are an error that lists the known ones.

func SplitList added in v0.1.4

func SplitList(s string) []string

SplitList splits a comma- or space-separated list of names.

Types

type Dirs

type Dirs struct {
	// Override is a templates directory to use instead of the embedded copy
	// (--templates, for working on the templates themselves).
	Override string
	// User holds your own environments (~/.config/limabean/templates). Each
	// <env>.yaml there can use the built-in layers: base: [./layer-base.yaml].
	User string
	// Cache is where the embedded copy is written (~/.cache/limabean/templates).
	Cache string
}

Dirs locates templates.

func (Dirs) Root

func (d Dirs) Root(embedded fs.FS) (string, error)

Root returns the directory limactl should read templates from.

type Pack added in v0.1.4

type Pack struct {
	Name        string
	Description string   // the TOML's first comment line
	Tools       []string // mise tools, as pinned
	Apt         []string // apt packages
	TOML        string   // the file, as written into the VM
}

Pack is a set of tools a VM can get: a mise TOML (packs/<name>.toml), and optionally system packages (packs/<name>.apt, one per line).

func Packs added in v0.1.4

func Packs(root string) ([]Pack, error)

Packs returns the packs in root/packs and the user's own in root/user-packs (which win over built-in ones of the same name), by name.

func (Pack) AptList added in v0.1.4

func (p Pack) AptList() string

AptList renders the pack's apt packages as the VM reads them.

func (Pack) Contents added in v0.1.4

func (p Pack) Contents() string

Contents describes what a pack installs, for listings.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL