config

package
v0.3.0 Latest Latest
Warning

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

Go to latest
Published: Oct 9, 2026 License: Apache-2.0 Imports: 9 Imported by: 0

Documentation

Index

Constants

View Source
const Example = `` /* 4802-byte string literal not displayed */

Variables

This section is empty.

Functions

func Discover

func Discover(dir string) (string, error)

func ParseForward

func ParseForward(spec string) (host, guest int, err error)

ParseForward splits a "host:guest" forward spec into its two ports.

Types

type CommandEntry

type CommandEntry struct {
	Cmd            string   `yaml:"cmd"`
	Timeout        duration `yaml:"timeout"`
	Retries        int      `yaml:"retries"`
	ValidExitCodes []int    `yaml:"valid-exit-codes"`
	Reboot         bool     `yaml:"reboot"`
}

type Config

type Config struct {
	From             string          `yaml:"from"`
	Hostname         string          `yaml:"hostname"`
	PE               bool            `yaml:"pe"`
	DWM              *bool           `yaml:"dwm"`
	WSL              *WSLConfig      `yaml:"wsl"`
	Packages         *PackagesConfig `yaml:"packages"`
	Features         []string        `yaml:"features"`
	Files            []FileEntry     `yaml:"files"`
	Ports            *PortsConfig    `yaml:"ports"`
	Vagrant          *VagrantConfig  `yaml:"vagrant"`
	BootstrapOnBuild bool            `yaml:"bootstrap_on_build"`
	Commands         commandsField   `yaml:"-"`
}

func Load

func Load(path string) (*Config, error)

func Parse

func Parse(data []byte) (*Config, error)

func (*Config) LoadDirectoryHooks

func (c *Config) LoadDirectoryHooks(dir string) error

func (*Config) ToBuildOpts

func (c *Config) ToBuildOpts() (*buildopts.BuildOpts, error)

func (*Config) UnmarshalYAML

func (c *Config) UnmarshalYAML(value *yaml.Node) error

func (*Config) Validate

func (c *Config) Validate() error

type FileEntry

type FileEntry struct {
	Src  string `yaml:"src"`
	Dest string `yaml:"dest"`
}

type PackagesConfig

type PackagesConfig struct {
	Chocolatey []string `yaml:"chocolatey"`
}

PackagesConfig lists packages to install via external package managers.

type PortsConfig

type PortsConfig struct {
	RDP     int `yaml:"rdp"`
	Gossh   int `yaml:"gossh"`
	OpenSSH int `yaml:"openssh"`
	// Forward lists extra host→guest TCP forwards as "host:guest", e.g.
	// "25900:5900" for a VNC server running inside the guest.
	Forward []string `yaml:"forward"`
}

PortsConfig sets the host-side ports forwarded into the build VM (and reused by the generated Vagrantfile). Zero values use the defaults: rdp 23389, gossh 20022, openssh 20122.

type VagrantConfig

type VagrantConfig struct {
	// SSHPort is the host port vagrant-qemu forwards to the guest's
	// OpenSSH. Overrides ports.openssh; when neither is set,
	// vagrant-qemu's 50022 default applies.
	SSHPort int `yaml:"ssh-port"`
}

VagrantConfig controls the Vagrantfile emitted next to the built image. Presence of the block enables emission (same as build --vagrant).

type WSLConfig

type WSLConfig struct {
	Image string `yaml:"image"`
	// NixHome selects the home-manager configuration for image: nix.
	// A local directory (must contain a flake exposing
	// homeConfigurations.<user>), a remote flake ref (github:org/repo,
	// git+https://...), or empty for the embedded default.
	NixHome string `yaml:"nixhome"`
	// NixHomeAttr overrides the homeConfigurations attribute name.
	NixHomeAttr string `yaml:"nixhome_attr"`
	// NixHomeUser is the username the flake's config was built for.
	NixHomeUser string `yaml:"nixhome_user"`
	// Services is a path to a directory of s6 service dirs (a standard
	// s6 scan dir layout: <dir>/<name>/run), copied verbatim into
	// /etc/s6/services of the distro. A subdir named like a built-in
	// service (sshd) overrides it.
	Services string `yaml:"services"`
}

Jump to

Keyboard shortcuts

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